Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Vigenere Cipher by _Chico_
import string, itertools
def diff(first, second):
for c1, c2 in zip(first, second):
yield string.ascii_uppercase[ord(c1) - ord(c2)]
def decode_vigenere(old, old_enc, enc):
key_haystack = ''.join(diff(old_enc, old))
for key in itertools.accumulate(key_haystack):
long_key = key * len(enc)
if long_key.startswith(key_haystack):
return ''.join(diff(enc, long_key))
May 21, 2021