Skip to content

Instantly share code, notes, and snippets.

@tete2soja
Created July 7, 2019 20:17
Show Gist options
  • Save tete2soja/617625fd91face0bfbfe2856e5b90d28 to your computer and use it in GitHub Desktop.
Save tete2soja/617625fd91face0bfbfe2856e5b90d28 to your computer and use it in GitHub Desktop.
ROT Brute force python script
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