Example #1
0
def test_feistel(L_00, L_10):
    """Test to see if a 2-stage feistel network was used for DES-like encryption

    >>> L2_00 = ('5f67abaf', '7b50baab', '290b6e3a', '39155d6f')
    >>> L2_10 = ('bbe033c0', 'ac343a22', 'd6f491c5', 'eea6e3dd')
    >>> [test_feistel(L2a, L2b) for (L2a, L2b) in zip(L2_00, L2_10)]
    ['unk', 'unk', 'INSECURE', 'unk']
    """
    L_xor = hexxor(L_00, L_10)
    if all(c == L_xor[(i + 1) % len(L_xor)] for i, c in enumerate(L_xor)):
        return 'INSECURE'
    return 'unk'
Example #2
0
def test_feistel(L_00, L_10):
    """Test to see if a 2-stage feistel network was used for DES-like encryption

    >>> L2_00 = ('5f67abaf', '7b50baab', '290b6e3a', '39155d6f')
    >>> L2_10 = ('bbe033c0', 'ac343a22', 'd6f491c5', 'eea6e3dd')
    >>> [test_feistel(L2a, L2b) for (L2a, L2b) in zip(L2_00, L2_10)]
    ['unk', 'unk', 'INSECURE', 'unk']
    """
    L_xor = hexxor(L_00, L_10)
    if all(c==L_xor[(i+1)%len(L_xor)] for i, c in enumerate(L_xor)):
        return 'INSECURE'
    return 'unk'
Example #3
0
def f2(x, y, hex=True):
    if hex:
        return hexxor(E(x, x), y)
Example #4
0
def f1(x, y, hex=True):
    if hex:
        return hexxor(E(y, x), y)
Example #5
0
def f2(x, y, hex=True):
    if hex:
        return hexxor(E(x, x), y)
Example #6
0
def f1(x, y, hex=True):
    if hex:
        return hexxor(E(y, x), y)