Skip to content

Instantly share code, notes, and snippets.

@justmytwospence
Last active August 29, 2015 14:13
Show Gist options
  • Save justmytwospence/65fb28bdf231026b988f to your computer and use it in GitHub Desktop.
Save justmytwospence/65fb28bdf231026b988f to your computer and use it in GitHub Desktop.
Fun brute force Caesar cipher decryptor
def brute_caesar_decrypt(encrypted):
import string
alphabet = string.ascii_letters
for shift in range(-13, 13):
shifted = alphabet[-shift:] + alphabet[:-shift]
decrypted = ''.join([shifted[alphabet.index(char)] for char in encrypted])
print decrypted.lower()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment