decrypt_procedure
def decrypt_procedure(chaine,key,table)
Algorithm
This method manage the decrypting procedure. It is ruled by the following steps :
Build the full key since the key argument
Split the string since separators via slurp method
Apply the inv_tranpose_base method to get the uncrypted terms
Solve the cumulated multiplied weigth with the equation solver
Convert the int list as result to ASCII chain
Parameters |
Type |
Description |
chaine |
str |
The raw crypted text as string |
key |
int list |
The half key as int list |
table |
list of list |
The Base Table array |
- Returns
str : The uncrypted text.
Source Code
res = ''
base=key[:]
tmp = []
key.reverse()
tmp = key[:]
to_find = []
to_find=slurp(chaine)
if(len(to_find)%2==0):
base+=tmp[0:len(key)]
else:
base+=tmp[1:len(key)]
tmp_liste=inv_transpose_base(to_find,base,table)
int_liste=resolve(tmp_liste)
res = int_to_ascii(int_liste)
return res