Skip to content

Instantly share code, notes, and snippets.

@pervognsen
Last active October 17, 2015 20:53
Show Gist options
  • Save pervognsen/30872f170eefa98c6c27 to your computer and use it in GitHub Desktop.
Save pervognsen/30872f170eefa98c6c27 to your computer and use it in GitHub Desktop.
for jp
from string import maketrans, ascii_lowercase as lc, ascii_uppercase as uc
rots = [maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n]) for n in range(26)]
def rot(s, n): return s.translate(rots[n % 26])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment