Skip to content

Instantly share code, notes, and snippets.

@RichardHyde
Created May 20, 2013 11:07
Show Gist options
  • Save RichardHyde/5611641 to your computer and use it in GitHub Desktop.
Save RichardHyde/5611641 to your computer and use it in GitHub Desktop.
ROT13 Encryption in Python
#!/usr/bin/python
from string import maketrans
from sys import stdin, stdout
alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
rot13 = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
r13table = maketrans(alpha, rot13)
orig = stdin.read()
stdout.write(orig.translate(r13table))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment