1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
''' fileName : VigenereDecrypto.py '''
def VigenereDecrypto (output , key) : ptLen = len (output) keyLen = len (key) quotien = ptLen // keyLen remainder = ptLen % keyLen
inp = ""
for i in range (0 , quotient) : for j in range (0 , keyLen) : c = int((ord(output[i*keyLen+j]) - ord('a') + 26 - (ord(key[j]) - ord('a')) % 26 + ord('a'))) inp += chr (c)
for i in range (0 , remainder) : c = int((ord(output[quotient*keyLen + i]) - ord('a') + 26 - (ord(key[i]) - ord('a')) % 26 + ord('a'))) inp += chr (c)
return inp
|