Question: For this challenge, implement the simple polyalphabetic Vigenre cipher. Using the template below, implement the encrypt() and decrypt() functions. Tests have been included at the

For this challenge, implement the simple polyalphabetic Vigenre cipher. Using the template below, implement the encrypt() and decrypt() functions. Tests have been included at the bottom of the template that can be used to verify your implementation is correct. Make sure to follow the instructions below, carefully following naming conventions where outlined.
#!/usr/bin/env python3
"""
Vigenre cipher
"""
import string
# String of all 26 alphabetical letters in uppercase
ALPHABET = string.ascii_uppercase
def encrypt(plaintext: str, key: str) -> str:
"""
TODO: Replace this with an explanation of your implementation
"""
# TODO: Replace this with your implementation
def decrypt(ciphertext: str, key: str) -> str:
"""
TODO: Replace this with an explanation of your implementation
"""
# TODO: Replace this with your implementation
if __name__ == "__main__":
# You can use this to test, or remove and do your own tests below
plaintext = "ATTACKATDAWN"
key = "LEMON"
expected = "LXFOPVEFRNHR"
ciphertext = encrypt(plaintext, key)
assert ciphertext == expected
assert plaintext == decrypt(ciphertext, key)

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!