Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the below substitution cipher using python3 Substitution Cipher example, if key is: bpzhgocvjdqswkimlutneryaxf, a string face will be decoded to obzg. Specific requirements are:

Write the below substitution cipher using python3

Substitution Cipher example, if key is: bpzhgocvjdqswkimlutneryaxf, a string face will be decoded to obzg.

Specific requirements are:

(1) Write a function substitutionEncrypt that takes a plaintext and a key (the default key is bpzhgocvjdqswkimlutneryaxf) to generate a ciphertext.

(2) Write a function keyGen that randomly generates a key.

(3) Write a testDrive (or main) function that takes a key code and an arbitrary number of strings, generate ciphertext for each string, and print out the key used, original and its ciphertext one by one. If (an empty string) is provided as the keyCode, then the default key will be used, otherwise, assuming the keyode is a non-empty string (e.g. R for random generation) a key is randomly generated.

Test the following cases:

Test 1: keycode is , two strings face and blow

Note: it will print out something like the following

Key: bpzhgocvjdqswkimlutneryaxf

face -> obzg, blow -> psiy

Test 2: same as Test 1 except keycode = r, i.e. key generated by keyGen

Test 3: key is , four strings wonderful, python, java, doedlugvusu

Test 4: Same as Test 3 except keycode = r, i.e. key generated by keyGen.

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_2

Step: 3

blur-text-image_3

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

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

=+Do you have any disabilities?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago