Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Vigenere Cipher by TovarischZhukov
def decode_vigenere(old_decrypted, old_encrypted, new_encrypted):
key = [chr (val+65) for i, elem in enumerate(old_decrypted) for val in range(26) if old_encrypted[i] == chr((val+ord(elem)-65)%26+65)]
key= "".join(key)
if len(old_encrypted) < len(new_encrypted) :
for i in range(2, len(key)):
k = key.find(key[:i], 1)
if k == len(key[:i]):
key = key[:i]
break
key = (len(new_encrypted)//len(key)+1)*key
message = [chr (val+65) for i, elem in enumerate(new_encrypted) for val in range(26) if elem == chr((val+ord(key[i])-65)%26+65)]
return "".join(message)
Dec. 14, 2015