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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started