Created
July 7, 2019 20:17
-
-
Save tete2soja/617625fd91face0bfbfe2856e5b90d28 to your computer and use it in GitHub Desktop.
ROT Brute force python script
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
from sys import argv | |
message = argv[1] | |
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
letters = 'abcdefghijklmnopqrstuvwxyz' | |
for key in range(26): | |
translated = '' | |
for letter in message: | |
if letter.isupper(): | |
current_alphabet = LETTERS | |
else: | |
current_alphabet = letters | |
num = current_alphabet.find(letter) | |
num = num - key | |
if num < 0: | |
num = num + len(current_alphabet) | |
translated += current_alphabet[num] | |
print('Key %s: %s' % (key, translated)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment