Vigenere Cipher
Encrypt and decrypt text using the classic polyalphabetic Vigenère cipher and its Beaufort variant with customizable keys and real-time processing.
What is the Vigenère Cipher?
The Vigenère Cipher is a classic method of encrypting alphabetic text by using a series of interwoven Caesar ciphers based on the letters of a keyword. It is a simplified form of a polyalphabetic substitution cipher, representing a significant historical advancement over simple monoalphabetic substitution ciphers like the Caesar cipher.
Though the cipher is named after the 16th-century French diplomat and alchemist Blaise de Vigenère, it was actually first described earlier in 1553 by the Italian cryptologist Giovan Battista Bellaso. Because it was incredibly difficult to crack for centuries, it earned the reputation of being le chiffre indéchiffrable (French for "the indecipherable cipher").
How Does the Vigenère Cipher Work?
In a standard Vigenère cipher, we align a plaintext string with a repeated **secret keyword**.
If we represent the letters of the alphabet (A-Z) as numbers from 0 to 25, the encryption of a plaintext letter \(P_i\) using a key letter \(K_i\) at position \(i\) is calculated as:
To decrypt a ciphertext letter \(C_i\) using the corresponding key letter \(K_i\), the formula is:
Step-by-Step Encryption Example
Let's encrypt the plaintext "CODE" using the secret keyword "KEY":
- Align the plaintext with the repeated key:
- Plaintext:
C O D E - Repeated Key:
K E Y K
- Plaintext:
- Convert letters to numerical indices:
- Plaintext indices:
C (2), O (14), D (3), E (4) - Key indices:
K (10), E (4), Y (24), K (10)
- Plaintext indices:
- Perform modular addition:
- \(C_1 = (2 + 10) \pmod{26} = 12 \rightarrow\)
M - \(C_2 = (14 + 4) \pmod{26} = 18 \rightarrow\)
S - \(C_3 = (3 + 24) \pmod{26} = 27 \pmod{26} = 1 \rightarrow\)
B - \(C_4 = (4 + 10) \pmod{26} = 14 \rightarrow\)
O
- \(C_1 = (2 + 10) \pmod{26} = 12 \rightarrow\)
The resulting ciphertext is "MSBO".
The Beaufort Cipher Variant
This tool also fully supports the **Beaufort Cipher** variant. The Beaufort cipher is mathematically very similar to Vigenère, but uses a slightly different algebraic substitution formula:
Because of this, the Beaufort cipher is **reciprocal** (or self-inverse), meaning the exact same mathematical formula and steps are used for both encryption and decryption.
Frequently Asked Questions
Frequently Asked Questions
How was the Vigenère Cipher eventually broken?
In 1863, Prussian military officer Friedrich Kasiski published a reliable method (known as the Kasiski examination) to break Vigenère ciphers. The technique involves identifying repeating patterns in the ciphertext to deduce the length of the secret key, and then performing frequency analysis on each individual Caesar cipher shift.
What happens if my key contains spaces or non-alphabet characters?
Our modern implementation automatically strips spaces, numbers, and punctuation from your secret key before processing. This ensures key alignment stays synchronized and consistent with classical guidelines.
Does the Vigenère Cipher encrypt spaces and punctuation?
By default, spaces, symbols, and numbers in the input are preserved exactly in their original positions and do not advance the secret key sequence. This makes the encoded result easy to read and format.
What is a Tabula Recta?
The Tabula Recta (or Vigenère square) is a 26x26 grid containing the alphabet shifted iteratively by one position in each consecutive row. Historically, cipher clerks used it to visually look up intersections of plaintext letters and key letters rather than doing mathematical calculations manually.
Related tools
Your recent visits