Skip to content

Instantly share code, notes, and snippets.

@yjkellyjoo
Last active October 16, 2019 06:24
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 yjkellyjoo/38627d859679e35525c83de05d2fa2f1 to your computer and use it in GitHub Desktop.
Save yjkellyjoo/38627d859679e35525c83de05d2fa2f1 to your computer and use it in GitHub Desktop.
simple python2 code which decrypts Caesor ciphered text
#!/usr/bin/python
#Caesor Cipher Hacker
message = raw_input("message to crack: ")
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for key in range(len(LETTERS)):
translated = ''
for symbol in message:
if symbol in LETTERS:
num = LETTERS.find(symbol)
num = num - key
if num < 0:
num = num + len(LETTERS)
translated = translated + LETTERS[num]
else:
translated = translated + symbol
print('Key #%s: %s' % (key, translated))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment