Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!