Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help. Thanks! 4. Write a menu-driven program (crypto.pyi that wil be simulating the encryption and decryption mechanism using rotation (see below Background section. The

Please help. Thanks! image text in transcribed
image text in transcribed
image text in transcribed
4. Write a menu-driven program (crypto.pyi that wil be simulating the encryption and decryption mechanism using rotation (see below "Background" section. The program should initially welcome the user and then prompt the user for one of three options as shon below (any other input should raise an error and the user should be re-prompted) Starting out with cryptography Encrypt sage 3. Quit Enter your choice and ehr t) You are allowed to use the string built-in methods and Python functions ord you are not allowed to use any user-defined non-void functions Consider the alphabet being used in the encryption-decryption mechanism to be the lower case English letters as shon below. Therefore, regardless i the user types strings with uppencase characters (e "Hello"), your program should make the encryption as if they were a lowercase (Hint: use the lower0 string method for the text entered by the user. o Extengions you can support uppercase encryption-decrvation mechanism too if you want o - extend your program -Your program should prompt the user for the 3 ogtions, and keep on printing the menu to the user until the user chooses the option 3 (Quit). Any other choice should raise an error and the user should be re-prompted Note that you should deck early n if the user entered a number (using the dig () bult-in method). You should be prompting the user for a new valid menu choice, until the user enters a proper one [this check should be completed before the user is asked for the plaintext or ciphertext messagel e if the chosen option is to encrypt (option 11, then the program prompts for a string (plaintext) and a rotation integer in the range of 1-25. The program should print-out the encrypted string ( ciphertext]. o The program should have a validation for the user-provided rotation valae as well Again use the:sdigit()method and check that isinthe proper range [1,25]). o Note: the program should not encrypt any character that is not an alphabetic character , , , , , , ! . . 1, should simply be passed .ash" to the Such characters (e4, espheztext. o Note: The text provided by the user, doesn't to be a single word, but it can be a whole sentence, e-Eello Crypto ! Encrypt ne ao r." the chosen option is to decnpt loption 21, then the program should prompt for a strig eiphertext) and a rotation integer in the range of 1-25. The program should print-out the decrypted string (plaintext Again, you need a validation of the user-proned rotation value as described above what was deveribed befiore also holds here for the decryption of non-alphabetic characters the chosen option is to 9it (option 3), then the program should print an nice exit fesup gracefully terminate. Note: To better understand how your program should work, see the sample output provided at the end. Background: A rotation cipher is one of the simplest and oldest encryption mechanism-ues in tring (plaiatextiand "translates" it into a new string leiphertext) based on a rotation of the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago