Пример #1
0
def PC_2(CiDi):
    '''
    Permutation Choice 2.
    Drop 8 bits and permute the remaining 48 input bits.
    56-bit -> 48-bit
    '''
    return (Permute(CiDi, PC_2_table))  # ok
Пример #2
0
def PC_1(key):
    '''
    Permutation Choice 1
    Discard the parity check bits, which cuts the 64-bit key into 56-bit key and then permute.
    64-bit -> 56-bit
    '''
    return (Permute(key, PC_1_table))  # ok
Пример #3
0
def IP(block):
    '''
    Initial permutation
    '''
    return Permute(block, IP_table)  # ok
Пример #4
0
def Permutation(HalfBlock):
    '''
    Rearrange the 32 outputs from the S-boxes according to a fixed permutation
    '''
    return Permute(HalfBlock, Permutation_table)  # ok
Пример #5
0
def Expansion(HalfBlock):
    '''
    Expand 32-bit half-block to 48 bits using the expansion permutation.
    32-bit -> 48-bit
    '''
    return Permute(HalfBlock, Expansion_table)  # ok
Пример #6
0
def FP(block):
    '''
    Final permutation
    '''
    return Permute(block, FP_table)  # ok