Question
Notebook 2: ROT ROT is a very simple cipher that is used to information hiding (https://en.wikipedia.org/wiki/ROT13) . Read the wiki page to understand how the
Notebook 2: ROT
ROT is a very simple cipher that is used to information hiding (https://en.wikipedia.org/wiki/ROT13) . Read the wiki page to understand how the encoder works.
a. Create an encode_rot() function to encode any given strings using ROT algorithm. The input should contain a key and a string of text. The key can be any integers both negative and positive (-12: turn left 12 positions, 36: turn right 36 positions). Only alphabet letters are encoded. The following two lines of your code will generate an output of Ocejkpg ECP ngctp 2 !!!. clear_text= Machine CAN learn 2 !!! encode_rot(clear_text, 28)
b. Create a decode_rot() to decode a ciphertext. The input only contains the ciphertext. The output contains the cleartext and the key that was used to encode text. The key will be between 0 and 25. (hint: Compare your decoded clear text with a dictionary text file and decide which one has the most dictionary words.) The following two lines will generate an output of The clear text is : Data is like people, interrogate it hard enough and it will tell you whatever you want to hear. The key is 16 cipher_text= Tqjq yi byau fuefbu, ydjuhhewqju yj xqht udekwx qdt yj mybb jubb oek mxqjuluh oek mqdj je xuqh. decode_rot(cipher_text)
c. Use your function to test more ciphertexts and show the results in your notebook . (you can use www.rot13.com or your encode_rot() function generate cipher texts).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started