Last active
August 29, 2015 14:13
-
-
Save justmytwospence/65fb28bdf231026b988f to your computer and use it in GitHub Desktop.
Fun brute force Caesar cipher decryptor
This file contains hidden or 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 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