Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Vigenere Cipher by rodka81
def decode_vigenere(old_decrypted, old_encrypted, new_encrypted):
seq = ''.join(chr(ord('A') + (ord(old_encrypted[i]) - ord(d)) % 26)
for i, d in enumerate(old_decrypted))
key = seq
for key_length in range(2, len(seq) // 2):
if seq in seq[:key_length] * (len(seq) // key_length + 1):
key = seq[:key_length]
return ''.join(chr(ord('A') + (ord(d) - ord(key[i % len(key)])) % 26)
for i, d in enumerate(new_encrypted))
Oct. 4, 2018