Skip to content

Instantly share code, notes, and snippets.

@joakibj
Created April 5, 2013 09:07
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 joakibj/5317825 to your computer and use it in GitHub Desktop.
Save joakibj/5317825 to your computer and use it in GitHub Desktop.
Basic ROT13 cipher solved in Python using a simple lookup table. Ukas nøtt #1
import sys, string
def rot13(x):
transtable = string.maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz','NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm')
return x.translate(transtable)
def main():
cipher = 'Qh re xnafxwr zhyvtraf ra ivaare'
print rot13(cipher)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment