- In this lab, you will work on Caesar Cipher and an implementation of the Vigenère Cipher, the system for encoding and decoding text messages that was discussed in class. You will program with Java or Python. Netbeans is the IDE for Java and Anaconda is the IDE for Python.
- Choose a secret sentence (Plaintext) of about 20 words and encrypt using Caesar Cipher with your own secret key. Fill the table 1 by using your plain text, secret key and corresponding ciphertext.
|Plaintext||Yesterday was excellent! Let’s meet again Tuesday at noon|
|Your secret Key||A shift of +3, i.e. A -> D|
|Ciphertext||Bhvwhugdb zdv hafhoohqw! Ohw’v phhw djdlq Wxhvgdb dw qrrq|
Table 1: Encryption
- Break the given Ciphertext encrypted by Caesar Cipher
|Ciphertext||Glzkx g cnork, Rozzrk Jaiqrotm cgy zoxkj ul vrgeotm. Ynk yixgshrkj av utzu znk mxgyye hgtq gtj lrallkj uaz nkx lkgznkxy zu jxe. Gxuatj nkx znk cotj cnoyvkxkj ot znk mxgyy. Znk rkgbky xayzrkj gtj ubkxnkgj znk yqe mxkc jgxq. Rozzrk Jaiqrotm xkgrofkj ynk cgy grr grutk.|
|Explain how you break the Ciphertext, provide details.Plaintext: After a while, Little Duckling was tired of playing. She scrambled up onto the grassy bank and fluffed out her feathers to dry. Around her the wind whispered in the grass. The leaves rustled and overhead the sky grew dark. Little Duckling realized she was all alone. To break the ciphertext, I used the brute force method. I wrote a Python script that would use all 26 keys from range 0 to 25 and printthem all in an output file. I then simply parsed through the file to find the sentence that was in plain English.|
Table 2: Decryption
Page 1 of 2
Part A: Use Java or Python to solve this exercise. In Java name your class as “Vigenere”. In Python name your program as “Vigenere”. Here are the requirements for the methods/functions. You may include other methods if needed
- Create a method/function in the class Vigenere that will encrypt a message using a specified key.
- Create a method/function in the class Vigenere that will decrypt a message using a specified key.
Part B: Write a main method/function in class Vigenere to do the following:
- Ask the user to enter the message “TO BE OR NOT TO BE THAT IS THE QUESTION”.
- Ask the user for the Vigenère key “RELATIONS”.
- Encode the message using the Vigenère cipher.
- Print the encrypted text.
- Decode the message using the Vigenère cipher.
- Print the result of decrying the encrypted text (which should be the original text).