Vigenère Cipher

A polyalphabetic cipher that uses a keyword to determine the shifting of each letter in the plaintext.

🏛️ Historical Background of the Vigenère Cipher

Alphabetic text encryption through Vigenère Cipher operates by applying a succession of Caesar ciphers deriving from specific keyword letters. Giovan Battista Bellaso first documented the Vigenère Cipher in the 16th century before Blaise de Vigenère received notoriety for its invention.

The association of Vigenère's name with this cipher occurred because he promoted a strengthened version after Bellaso's initial creation achieved wider usage as Vigenère's method.

A main difference between the Caesar Cipher and Vigenère Cipher is that the latter employs different shifts derived from a keyword to encrypt messages thus making it harder for attackers to decipher messages. For more than three hundred years the cipher remained indescipherable until cryptographers managed to break it during the nineteenth century.

🧠 Fun Fact:The Vigenère Cipher is an early example of polyalphabetic substitution, a major advancement in cryptographic history!

🔐 Vigenère Cipher Principle

The Vigenère Cipher is a polyalphabetic substitution cipher that uses a keyword to determine the shifting pattern of each character in the plaintext. Each letter in the keyword corresponds to a shift based on its position in the alphabet (A = 0, B = 1, ..., Z = 25). The keyword is repeated or truncated to match the length of the message.

Example: With the keyword KEY and the plaintext HELLO, the encryption works as follows:

  • H (7) + K (10) = 17 → R
  • E (4) + E (4) = 8 → I
  • L (11) + Y (24) = 35 → 9 → J
  • L (11) + K (10) = 21 → V
  • O (14) + E (4) = 18 → S

Result: Encrypted text = RIJVS

Key Characteristics:

  • Keyword-Based Shifts: Each letter in the keyword determines the shift for its corresponding letter in the plaintext.
  • Polyalphabetic Nature: Unlike Caesar cipher, each letter in the message can be shifted by a different amount, depending on the keyword.
  • Repetition of Keyword: If the keyword is shorter than the message, it is repeated to cover the entire message.
  • Alphabet Wrapping: If the shifted letter goes beyond Z, it wraps back around to the beginning of the alphabet.

Mathematical Representation:

🔐 Encryption:

Ci = (Pi + Ki) mod 26

🔓 Decryption:

Pi = (Ci - Ki + 26) mod 26

Where:

  • Pi: Position of the plaintext letter (A = 0, B = 1, ..., Z = 25)
  • Ki: Position of the corresponding keyword letter
  • Ci: Position of the resulting ciphertext letter
💡 Did You Know? The Vigenère Cipher was once considered "unbreakable" for over 300 years until methods like frequency analysis advanced enough to crack it!

✏️ Step-by-Step Guidance to Vigenère Cipher

🔐 Caesar Cipher Encryption

Step 1: Choose a Keyword

The keyword is a word or phrase used to determine the letter shifts for each character in the plaintext.

Example: Keyword = KEY

Step 2: Write Down the Plaintext

The plaintext is the original message. Only alphabetic characters are shifted.

Example: Plaintext = HELLO

Step 3: Repeat the Keyword

Repeat the keyword to match the length of the plaintext.

Plaintext: H E L L O
Keyword : K E Y K E

Step 4: Encrypt Each Letter

Shift each letter in the plaintext by the alphabetical index of the corresponding keyword letter.

                    H (7) + K (10) = 17 → R  
                    E (4) + E (4) = 8 → I  
                    L (11) + Y (24) = 35 → 9 → J  
                    L (11) + K (10) = 21 → V  
                    O (14) + E (4) = 18 → S

                    🔐 Encrypted Text: RIJVS
                    

🔓 Vigenère Cipher Decryption

Step 1: Use the Same Keyword

The same keyword is required to decrypt the message.

Example: Keyword = KEY

Step 2: Write Down the Ciphertext

Example: Ciphertext = RIJVS

Step 3: Repeat the Keyword

Ciphertext: R I J V S
Keyword: K E Y K E

Step 4: Decrypt Each Letter

Subtract the alphabetical index of the keyword letter from the ciphertext letter, wrap around if needed.

                    R (17) - K (10) = 7 → H  
                    I (8) - E (4) = 4 → E  
                    J (9) - Y (24) = -15 + 26 = 11 → L  
                    V (21) - K (10) = 11 → L  
                    S (18) - E (4) = 14 → O

                    🔓 Decrypted Text: HELLO
                    

Vigenère Cipher Quiz

Hint:
  • Use the Vigenère Cipher to either encrypt or decrypt the text.
  • Remember, the key is used repeatedly for both encryption and decryption.
  • When encrypting: same letter in the plaintext and key => shift forward in the alphabet.
  • When decrypting: same letter in the ciphertext and key => shift backward in the alphabet.

Result:

Score: 0

📚 Additional Resources