adds key to ROT ex

This commit is contained in:
waldek 2021-11-12 11:25:13 +01:00
parent 7a4af42cc1
commit 548c7bba7b
1 changed files with 6 additions and 0 deletions

View File

@ -1469,6 +1469,12 @@ if __name__ == "__main__":
To make things more interesting you can add a decode function. To make things more interesting you can add a decode function.
Plus you could add a prompt that asks how big the shift should be (ROT13, ROT16, ...). Plus you could add a prompt that asks how big the shift should be (ROT13, ROT16, ...).
You can make the cypher a **lot** harder to break if you use a word (or phrase as a key).
For example, if the key is `abc` and the message is `hello world` the first letter will be offset by a ROT0 (will remain `h`).
The second letter, `e` will be offset by a ROT1 so will become `f`.
The third letter by ROT2 so will become `n`.
Now, the fourth letter will be offset again by `a` so ROT0 and will become `l`.
And so on...
# List comprehension # List comprehension