Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a script in Python that is an implementation of a version of the Vigenere cipher for English text. Your script should distinguish lowercase and
Write a script in Python that is an implementation of a version of the Vigenere cipher for English text. Your script should distinguish lowercase and uppercase letters (i.e., the encryption key and the plaintext are allowed to be composed of lowercase and uppercase letters but the ciphertext should be uppercase). In addition to letters, there will be four other characters in the plain text: comma (26), dot (27), dash (28), underscore (29) changing the encryption function to be under mod 30. Your script should read from standard input and write to standard output. It should prompt the user for the encryption key of size k. Then key is not allowed to be repeated as in the standard Vigenere cipher. Instead, we will follow a block cipher-based idea. Basically, the plaintext and ciphertext will have blocks of size k which is same as the key size. If the key length is shorter than the plaintext, the ciphertext of block size k of the previous block is concatenated to the key. Here is an example: When the keyword is CapeGirardeau with k = 13:
Note:
Enter some text to encrypt: SEMO_CS-Department-is-the-best
Enter a key: CapeGirardeau
Plaintext: SEMO_CS-Department-is-the-best
Key: CapeGirardeauUE.SFKF-UHTAHJQBB
Ciphertext: UE.SFKF-UHTAHJQBBYINQS,,EFKUTU
Need the answer in python.
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