Created
April 7, 2014 23:35
-
-
Save veltman/10073570 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
ciphered = [ | |
{ | |
"offset": 11, | |
"text": "HAPCV ITGBH UDG JCXITS HIPITH RJGGTCRN" | |
}, | |
{ | |
"offset": 9, | |
"text": "UVRU DLJZTZREJ" | |
}, | |
{ | |
"offset": 5, | |
"text": "HZHWZMN JA JIZ YDMZXODJI" | |
} | |
] | |
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
def offset(ch,o): | |
return alphabet[(alphabet.index(ch) + o) % len(alphabet)] | |
for row in ciphered: | |
decoded = "" | |
for char in row["text"]: | |
if char != " ": | |
decoded += offset(char,row["offset"]) | |
else: | |
decoded += " " | |
print decoded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment