Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Talking 'bout my generation solution in Creative category for ADFGVX Cipher by veky
def p(w, s):
k = dict(enumerate(dict.fromkeys(w)))
for i in sorted(k, key=k.get): yield from range(i, len(s), len(k))
def encode(m, a, k):
s = ['ADFGVX'[i] for c in m.casefold() if c.isalnum()
for i in divmod(a.index(c), len('ADFGVX'))]
return ''.join(s[j] for j in p(k, s))
def decode(m, a, k):
d = map('ADFGVX'.index, dict(sorted(zip(p(k, m), m))).values())
return ''.join(a[len('ADFGVX')*i + j] for i, j in zip(d, d))
Nov. 3, 2017
Comments: