RU EN ES 中文

Vigenère Cipher

A polyalphabetic cipher considered "unbreakable" for three centuries — one that changed the course of cryptography

Why do we need this?

Imagine you are Alice, a Renaissance-era diplomat. You need to send a secret message to Bob, but the mail isn't safe — letters get intercepted, opened, copied.

A simple substitution cipher (where A→X, B→C, and so on) is easy to break with frequency analysis: in any given language, certain letters appear far more often than others — so the most common symbol in the ciphertext is likely the most common letter of the alphabet.

The Vigenère cipher solves this problem. Instead of one alphabet, it uses many alphabets, switching between them according to a keyword. The same plaintext letter gets encrypted differently depending on its position — so frequency analysis stops working.

The method was considered so reliable that it was called "le chiffre indéchiffrable" — "the indecipherable cipher." It wasn't until 1863 that Friedrich Kasiski published a method for breaking it.

How does it work?

At the heart of the cipher is the Vigenère table: a 33×33 square (for the Russian alphabet), where each row is the alphabet shifted by one more position.

1

Preparing the table

The first row is the plain alphabet. Each following row is shifted one position to the left. Row number K starts with the K-th letter of the alphabet.

Example for English (first 3 rows):

ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
2

Choosing a key

Alice and Bob agree on a keyword, for example KEY. This word repeats cyclically underneath the message:

Message: П Р И В Е Т М И Р У !
Key: К Л Ю Ч К Л Ю Ч К Л
3

Encryption

For each letter of the message:

  • Find the row using the key letter
  • Find the column using the message letter
  • The intersection gives the encrypted letter

Formula: C = (P + K) mod N

where P is the plaintext position, K is the key position, N is the alphabet size, and C is the ciphertext.

4

Decryption

Bob uses the same table, but in reverse:

  • Row = the key letter
  • In that row, find the ciphertext symbol
  • The column it sits in gives the original letter

Formula: P = (C − K + N) mod N

The math behind the Vigenère cipher
🔐 Encryption
C = (P + K) mod N
Example:
Encrypting П with key К
П = 16th letter (0-indexed), К = 11th
(16 + 11) mod 33 = 27 → Ъ
🔓 Decryption
P = (C − K + N) mod N
Example:
Decrypting Ъ with key К
Ъ = 27, К = 11, N = 33
(27 − 11 + 33) mod 33 = 16 → П
Why did this work?
Every plaintext letter is encrypted into different letters depending on the key's position. The frequency analysis that breaks simple substitution ciphers becomes useless — the letter "O" might turn into "A," "M," "Щ," and so on.
Key length > 5 → high resistance
* In the game, the table is visualized: rows and columns light up at every step, so you can watch the process happen live.
Key takeaway: Vigenère's strength lies in repeating the key. The longer and more random the key, the harder it is to break. But that very cyclicality became its weakness: the Kasiski method uses repetitions in the ciphertext to find the key length, then applies frequency analysis to each "substring" separately.

And now for the real magic

What will you actually do in the simulation?

In the game you don't just read about Vigenère — you live through the whole cycle: from typing the message to a successful transfer. You'll see an abstract formula turn into a vivid animation, and understand why this cipher was a breakthrough for its time.

For the curious

Historical background

The cipher was first described by Giovan Battista Bellaso in 1553, but was mistakenly attributed to Blaise de Vigenère, who described it in 1586. The name stuck, and today we still call it the "Vigenère cipher."

Why was it broken?

In 1863, the Prussian officer Friedrich Kasiski published a method that exploits repetitions in the ciphertext. If the same plaintext phrase is encrypted with the same fragment of the key, the same sequence will appear in the ciphertext. The distance between such repetitions is often a multiple of the key length.

Once the key length is known, a cryptanalyst splits the ciphertext into groups (all letters encrypted with the first key symbol, the second, and so on) and applies frequency analysis to each group separately.

Topics for further study

If you want to dive deeper into cryptography, here are the key topics:

Frequency analysis

How language statistics help break ciphers: letter, bigram, and trigram frequencies

The Kasiski method

An algorithm for finding key length from repetitions in the ciphertext

Index of coincidence

Friedman's statistical test for determining key length

The one-time pad

The only theoretically unbreakable cipher: key length = message length, used only once

Modern block ciphers

How the ideas behind polyalphabetic ciphers evolved into AES, ChaCha20, and other algorithms

Cryptanalysis in Python

Practical scripts for frequency analysis and attacks on the Vigenère cipher

Practical uses today

Although the Vigenère cipher isn't used to protect real data anymore, it remains:

  • An excellent teaching example of polyalphabetic encryption
  • A foundation for understanding more complex algorithms
  • A staple of CTF competitions and cryptography puzzles
  • A historical bridge between classical and modern cryptography

Now that you understand the basics, it's the perfect time to try it in practice and see the cipher in action!

In the interactive simulation you can encrypt your own message and watch every step of the process.