Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Python to create the Caesar Cipher Application A very simple encryption method that has been in use for thousands of years is called a

Use Python to create the Caesar Cipher Application

A very simple encryption method that has been in use for thousands of years is called a Caesar cipher. Recall that the character set for text is ordered as a sequence of distinct values. This encryption strategy replaces each character in the plain text with the character that occurs a given distance away in the sequence. For positive distances, the method wraps around to the beginning of the sequence to locate the replacement characters for those characters near its end. For example, if the distance value of a Caesar cipher equals two characters, the string california would be encrypted as ecnkhqtpkc. To decrypt this cipher text back to plain text, you apply a method that uses the same distance value but looks to the left of each character for its replacement. This decryption method wraps around to the end of the sequence to find a replacement character for one near its beginning.

Finish coding the decrypt()function of Caesar Cipher Application which is stored in the Caesar Cipher.py file located in Project 7 folder on Blackboard. The application prompts the user for the distance to be used. It then asks for three one-word, lowercase messages which are stored in a python set. The messages are then encrypted based on the distance inputted. The application uses the decrypt() function to decrypt the contents of the set. The program output should be formatted as shown in the Sample Run.

Note: The ord() function returns the ordinal position of a character value in the ASCII sequence. For example:

ord('a') returns 97

ord('b') returns 98

ord('c') returns 99

...

ord('z') returns 122

To complete this assignment, you will need to use the Caesar Cipher.py file located in Project 7 folder on Blackboard.

SAMPLE RUN:

Enter a distance value between 0 and 25: 3

Enter a one-word, lowercase message: zebra

Enter a one-word, lowercase message: lion

Enter a one-word, lowercase message: apple

The encrypted set includes {'olrq', 'dssoh', 'cheud'}

Decryption results

olrq -> lion

dssoh -> apple

cheud -> zebra

______________________________________________________________

Enter a distance value between 0 and 25: 2

Enter a one-word, lowercase message: yellowstone

Enter a one-word, lowercase message: california

Enter a one-word, lowercase message: csu

The encrypted set includes {'ecnkhqtpkc', 'agnnqyuvqpg', 'euw'}

Decryption results

ecnkhqtpkc -> california

agnnqyuvqpg -> yellowstone

euw -> csu

___________________________________________________________

Enter a distance value between 0 and 25: 0

Enter a one-word, lowercase message: yellowstone

Enter a one-word, lowercase message: california

Enter a one-word, lowercase message: csu

The encrypted set includes {'california', 'yellowstone', 'csu'}

Decryption results

california -> california

yellowstone -> yellowstone

csu -> csu

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions