Skip to content

Instantly share code, notes, and snippets.

@mharju
Last active December 18, 2015 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mharju/5746975 to your computer and use it in GitHub Desktop.
Save mharju/5746975 to your computer and use it in GitHub Desktop.
Encoding and decoding QWERTY-ciphers with constant transposition of one letter.
qwerty = u"qwertyuiopåasdfghjklöä'zxcvbnm,"
transpose = lambda s,t: ''.join([ (qwerty[qwerty.index(c)+t] if c in qwerty else c) for c in s])
encode = lambda s: transpose(s, 1)
decode = lambda s: transpose(s, -1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment