In the world of cryptography, the Vigenère Cipher represents a significant milestone in the evolution of encryption techniques. To fully appreciate its significance, let’s take a step back and explore its roots, starting with the Caesar Cipher.
The Caesar Cipher: A Historical Foundation
The Caesar Cipher, named after Julius Caesar who used it to protect sensitive information, is one of the earliest known encryption methods. It operates by shifting each letter in the plaintext by a fixed number of positions down the alphabet. For example, with a shift of 3, ‘A’ becomes ‘D’, ‘B’ becomes ‘E’, and so on. With this encryption technique the key represents the number used for shifting letters in the alphabet. (e.g. in our example the key is 3).
While simple and effective for its time, the Caesar Cipher is easy to break. Effectively, with the Caesar Cipher there are only 26 possible keys, so it’s easy to try them all to decode an encrypted message. The Caesar Cipher is also vulnerable to frequency analysis, where the frequency of letters in the ciphertext is analysed to deduce the original message. This limitation paved the way for more complex encryption methods, including the Vigenère Cipher.
The Vigenère Cipher: Enhancing Security
The Vigenère Cipher, invented by Blaise de Vigenère in the 16th century, builds upon the principles of the Caesar Cipher but introduces a significant enhancement: it uses a keyword to determine the shift for each letter in the plaintext. This means that instead of a single shift value, the Vigenère Cipher employs a different shift for each letter of the message to encrypt, making it much harder to crack using a frequency analysis. It also means that any keyword (or sequence of letters) can be used as the key which exponentially increases the number of possible unique keys available and making it virtually impossible for a human being to try all the possible keys one at a time.
How the Vigenère Cipher Works
Step 1: Choose the key: Decide on a keyword that will be used to encrypt the message. For example, let’s use the keyword “CRYPTO”
Step 2: Align the key with the plaintext: Align the keyword along the length of the plaintext. As the plaintext message will most likely be longer than the key, you may have to repeat the key. For instance ff the plaintext is “VIGENERECIPHER” and the KEY is “CRYPTO” the alignment would look like this:
Plaintext: V I G E N E R E C I P H E R Keyword: C R Y P T O C R Y P T O C R
Step 3: Apply Caesar Shift Encryption: Shift each letter in the plaintext by the position in the alphabet of the corresponding letter of the key. For instance, ‘V’ is shifted by ‘2’ as ‘C’ is at position 2 in the alphabet (we start with position 0 for ‘A’) so ‘C’ becomes ‘X’, whereas ‘I’ is shifted by 17 as ‘R’ is at position 17 in the alphabet.
Python Challenge: Implementing the Vigenère Cipher
Now that you have a basic understanding of both the Caesar Cipher and the Vigenère Cipher, it’s time to put your programming skills to the test! Below is a Python challenge to implement both ciphers.
Tips:
Convert the plaintext and keyword to uppercase to handle case sensitivity.
Use the ASCII values of the letters to perform the shifts.
When shifting a letter, if the resulting letter is after Z, it should go back to the start of the alphabet. (e.g. ‘X’ shifted by 3 becomes ‘A’)
For the Vigenère Cipher, ensure the key repeats to match the length of the plaintext.
Getting Started: Caesar Cipher
The following code will help you identify the main steps of a Caesar Cipher algorithm:
plaintext="CAESAR" key = 3 cipher = "" # Parse through the plaintext, one character at a time for i in range(0, len(plaintext)): #Retrieve the ASCII value for the current character ascii = ord(plaintext[i]) #Only encrypt letters from the alphabet, from A=65 to Z=90 if ascii>=65 and ascii<=90: # Encrypt the letter by shifting the ASCII value by the key ascii = ascii + key # If the new encrypted letter is after Z, it goes back to A if ascii > 90: ascii = ascii - 26 cipher = cipher + chr(ascii)
Extension Task:
Extend your implementation to include two decryption functions that take the encrypted text and the key as inputs and return the original plaintext.

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area