Cryptography
1.0
Implementation of Cryptography Algorithms
|
Namespaces | |
DESKeygen | |
Functions | |
def | DESKeygen.binary_string (k) |
BINARY STRING COVERSION. More... | |
def | DESKeygen.get_x_bit_permutation (k, pc) |
GET PERMUTATION STRING. More... | |
def | DESKeygen.perform_xor (first_d, second_d) |
def | DESKeygen.compression_to_32 (string) |
GET PERMUTATION STRING. More... | |
Variables | |
list | DESKeygen.EXPANSION |
This is an implementation of DES Cipher Algorithm DES = Data Encryption Standard STEP 1: create all constants first. More... | |
list | DESKeygen.IP |
IP = Initial Permutation This is used to permute the plain_text binary form based on the beloe stated table. More... | |
list | DESKeygen.PC1 |
PC1 = Permuted Choice 1 This is used to permute the plain_text binary form based on the below stated table. More... | |
list | DESKeygen.PC2 |
PC2 = Permuted Choice 2 This is used to permute the plain_text binary form based on the below stated table. More... | |
list | DESKeygen.LEFTROTS |
list | DESKeygen.S |
S-Boxes We now do something strange with each group of six bits: we use them as addresses in tables called "S boxes". More... | |
list | DESKeygen.Reduced_ka_permutation |
int | DESKeygen.hexa_scale = 16 |
DESKeygen.key = str(input()) | |
DESKeygen.plaintext = str(input()) | |
DESKeygen.L = plaintext[0:8] | |
DESKeygen.R = plaintext[8:16] | |
DESKeygen.plain_binary = binary_string(plaintext) | |
DESKeygen.b_key = binary_string(key) | |
DESKeygen.five_six_perm = get_x_bit_permutation(b_key, PC1) | |
list | DESKeygen.C = [] |
list | DESKeygen.D = [] |
DESKeygen.first = C[i - 1][0] | |
DESKeygen.second = D[i - 1][0] | |
DESKeygen.Cx = C[i - 1][1:28]+first | |
DESKeygen.Dx = D[i - 1][1:28]+second | |
list | DESKeygen.key_list = [] |
list | DESKeygen.hex_key_list = [] |
DESKeygen.initial_permutation = get_x_bit_permutation(plain_binary, IP) | |
DESKeygen.L0 = initial_permutation[0:32] | |
DESKeygen.R0 = initial_permutation[32:64] | |
DESKeygen.L1 = copy(R0) | |
DESKeygen.ER0 = get_x_bit_permutation(R0, EXPANSION) | |
DESKeygen.func_ER0K1 = perform_xor(key_list[0], ER0) | |
DESKeygen.reduced_value = compression_to_32(func_ER0K1) | |
DESKeygen.permuted_reduced_val = get_x_bit_permutation(reduced_value, Reduced_ka_permutation) | |
DESKeygen.R1 = perform_xor(L0, permuted_reduced_val) | |
DESKeygen.final_bit_string = L1+R1 | |
DESKeygen.final_res = hex(int(final_bit_string, 2))[2:].upper() | |