Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Caesar Cipher for Decryption(python): step 1 Write a decryption function called decipher chr(). In this function you will subtract the offset rather than adding

The Caesar Cipher for Decryption(python): step 1

Write a decryption function called decipher chr(). In this function you will subtract the offset rather than adding it! Of course, you should also change the text appropriately as well as names and docstrings.

The proper behavior of this function is shown below:

decipher_chr( , 1) # with an offset of 1.

decipher_chr(F, 5) # F with an offset of 5.

'A'

The Caesar Cipher for Decryption: Step 2

write a function called cipher2clear() that takes two arguments, a cipher text string to cipher and an offset, and returns a clear text string. When the same offset is used for the decryption as was used for the encryption, the original clear text is recovered. First you must import your decipher chr() function. Then start your cipher2clear function by initializing an empty string accumulator. Use a for-loop to cycle through each character of the cipher text, deciphering each character by calling decipher chr() and concatenating the cleared character to the accumulator as you go.

The following demonstrates the correct behavior of this function:

# Import decipher_chr().

from decipher_chr import *

line = Xutsyfsjny%mfx%nyx%ynrj%fsi%uqfhj3

cipher2clear(line, 5)

Spontaneity has its time and place.

cipher2clear(BCD!234, 1)

ABC 123

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

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions

Question

Describe the sources of long term financing.

Answered: 1 week ago