From 548c7bba7be962a0e1670ab1754f4dc7be1e520b Mon Sep 17 00:00:00 2001 From: waldek Date: Fri, 12 Nov 2021 11:25:13 +0100 Subject: [PATCH] adds key to ROT ex --- learning_python3.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/learning_python3.md b/learning_python3.md index a4bbc54..80245b3 100644 --- a/learning_python3.md +++ b/learning_python3.md @@ -1469,6 +1469,12 @@ if __name__ == "__main__": 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, ...). +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