Skip to content

Instantly share code, notes, and snippets.

@veltman
Created April 7, 2014 23:35
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 veltman/10073570 to your computer and use it in GitHub Desktop.
Save veltman/10073570 to your computer and use it in GitHub Desktop.
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