Last active
August 24, 2018 17:31
-
-
Save thiagodeschamps/a2fceaa732427ad520be0ed7da80803d to your computer and use it in GitHub Desktop.
Show all the possible combinations in a Ceasar encripture
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
def decypher(word): | |
des = '' | |
pos = 0 | |
for c in range(0, 26): | |
for i in word: | |
if ord(i.upper()) + c > 90: | |
pos = 64 | |
aux = ord(i.upper()) + c - 90 | |
des += chr(pos + aux) | |
else: | |
pos = ord(i) | |
des += chr(pos + c) | |
print(des, f'- key = {c}') | |
des = '' | |
word = str(input('Insert the word to shift in all possible ways: ')) | |
decypher(word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment