Created
February 10, 2016 17:59
-
-
Save georules/50c169503fd740f1eaba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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