Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Explained solution in Clear category for Vigenere Cipher by veky
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))
Sept. 11, 2015
Comments: