CS8 Programming Assignment 3DescriptionIn this programming assignment, you will implement the Vigenère encryption algorithm (cipher). Refer to the Wikipedia page about the algorithmic details of the Vigenère cipher. You should pay special attention to:
In our project, we will use the lower case letters "a" to "z", the numbers "0" to "9", and the space " ", the dot ".", the comma ",", the question mark "?", and the exclamation mark "!" characters. Our input alphabet is alphabet = "abcdefghijklmnopqrstuvwxyz0123456789 .,?!"which has 26+10+5=41 elements, and thus, we will use mod 41 arithmetic. Therefore the lower case letter ("a" to "z") indices are 0 to 25, the number ("0" to "9") indices are 26 to 35, and the indices for the space, dot, comma, question mark, exclamation mark characters are respectively 36, 37, 38, 39, and 40. RequirementsYou need to write two functions, as described below. Function names and parameter properties must be as specified.
An Encryption ExampleKey: lemonadePlaintext: meet me at caje at 2pm! According to the variable alphabet (above), the indices of the (repeated) key and text letters are: Key : l e m o n a d e l e m o n a d e l e m o n a d Key : 11 04 12 14 13 00 03 04 11 04 12 14 13 00 03 04 11 04 12 14 13 00 03 Text: m e e t m e a t c a j e a t 2 p m ! Text: 12 04 04 19 36 12 04 36 00 19 36 02 00 09 04 36 00 19 36 28 15 12 40The encrypted text is obtained using mod 41 addition as Key : 11 04 12 14 13 00 03 04 11 04 12 14 13 00 03 04 11 04 12 14 13 00 03 Text: 12 04 04 19 36 12 04 36 00 19 36 02 00 09 04 36 00 19 36 28 15 12 40 -------------------------------------------------------------------------- Ciph: 23 08 16 33 08 12 07 40 11 23 07 16 13 09 07 40 11 23 07 01 28 12 02 Ciph: x i q 7 i m h ! l x h q n j h ! l x h b 2 m cTherefore, the resulting ciphertext is xiq7imh!lxhqnjh!lxhb2mc What To SubmitWrite both of your functions encVigenere and decVigenere in a Python text file named pa3.py, and submit your file using the Dropbox link. Your functions will be tested using random values of key, plaintext, and ciphertext.Submit only the functions; no test programs outside the functions are needed. Also, you may write and include in your pa3.py file as many helper functions as you want. Note that your functions encVigenere and decVigenere return values, not print them! Furthermore, your functions should work with any length key, plaintext, and ciphertext, each of each is at least 1 character. This programming assignment is graded out of 15 points, i.e., it has 5 points of extra credit.
Important: Add your full name and email address as a
comment in the first line of your file, such as:
cs8 web page |