Question: Description In this programming assignment, you will implement the Vigenre encryption algorithm (cipher). Refer to theWikipedia page about the algorithmic details of the Vigenre cipher.

Description

In this programming assignment, you will implement the Vigenre encryption algorithm (cipher). Refer to theWikipedia page about the algorithmic details of the Vigenre cipher. You should pay special attention to:

Section "Description" for a real example;

Section "Algebraic description" for mathematical illustration

The Vigenre algorithm explained in this Wikipedia page uses the input alphabet as 26 capital letters from A to Z, and it is based on mod 26 arithmetic.

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.

Requirements

You need to write two functions, as described below. Function names and parameter properties must be as specified.

The encryption function definition is

def encVigenere(key, plaintext) 

Both key and plaintext are string arguments, such as

encVigenere("my key for today","attack at dawn!") 

The function accepts an plaintext message of any length (a string of at least 1 character) and encrypts it using the key of any length (which is another string of at least 1 character), and returns the encrypted text (called ciphertext). The length of the ciphertext and plaintext will be the same. The key length may be shorter or longer than the plaintext.

Similarly, the decryption function definition is

def decVigenere(key, ciphertext) 

Both key and ciphertext are string arguments. The function accepts the ciphertext as input, and decrypts it using the key, obtains back the original message (the plaintext) and returns it.

What To Submit

Submit only the functions

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!