Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the polyalphabetic cipher that uses a word as the key for shifting the plaintext and creating ciphertext. When the keyword is smaller than the plaintext,

the polyalphabetic cipher that uses a word as the key for shifting the plaintext and creating ciphertext. When the keyword is smaller than the plaintext, the keyword is repeated. A variation on this algorithm uses the keyword to shift the plaintext, and if the keyword is smaller than the plaintext, the keyword is used, followed by the reverse of the keyword, and then the keyword again until all letters in the plaintext are shifted. For example, given the following plaintext and keyword:

plaintext = computerscience

keyword = code

we would encrypt the plaintext by shifting each letter by the corresponding letter of the keyword followed by the reverse of the keyword:

computerscience

codeedoccodeedo

c would be shifted by c, o would be shifted by o, m would be shifted by d, p would be shifted by e, the u would be shifted by e, and so on.

The resulting ciphertext of the example above would be:

ecptywstuqlirfs

Write a function in python that implements this variation on the polyalphabetic cipher. The parameters of the function will be the plaintext and the keyword. The function will return the ciphertext. Write another function that deciphers this variation of the polyalphabetic cipher.

Test your functions with the following examples:

polyReverse("computerscience","code")

"ecptywstuqlirfs"

unPolyReverse(ecptywstuqlirfs,code)

computer science

polyReverse(supercalifragilistic,poppins)

hietzpsdvngpuxawhiqp

unPolyReverse(hietzpsdvngpuxawhiqp, poppins)

supercalifragilistic"

I just need it to be written in python please

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

A Complete Guide To Data Science Essentials

Authors: Miguel

1st Edition

9358684992, 978-9358684995

More Books

Students also viewed these Databases questions

Question

explain the need for human resource strategies in organisations

Answered: 1 week ago

Question

describe the stages involved in human resource planning

Answered: 1 week ago