Skip to content

Instantly share code, notes, and snippets.

@georules
Created February 10, 2016 17:59
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 georules/50c169503fd740f1eaba to your computer and use it in GitHub Desktop.
Save georules/50c169503fd740f1eaba to your computer and use it in GitHub Desktop.
def encrypt(message, key):
encMessage = ""
for m in message:
n = ord(m) + key
encMessage = encMessage + chr(n)
return encMessage
def decrypt(message, key):
decMessage = ""
for m in message:
n = ord(m) - key
decMessage = decMessage + chr(n)
return decMessage
m = encrypt("Hello",1)
print decrypt(m,1)
for key in range(1,10):
print decrypt("message", key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment