Cracking the Vigenère Cipher
Vigenère stayed unbreakable for three centuries until Friedrich Kasiski spotted that repeated plaintext + repeating key produces repeated ciphertext. Find the period, then brute-force each Caesar slice.
Step 1 · Kasiski examination
Trigrams (and longer) that repeat in the ciphertext almost certainly come from the same plaintext encrypted by the same slice of the key. Their distance apart is therefore a multiple of the key length.
Step 2 · Score candidate key lengths
For each candidate length L, count how many of those
distances are divisible by L. The true key length wins by
a wide margin. Click any row to crack with that length.
Step 3 · Brute force each Caesar slice
Split the ciphertext into L
cosets — every L-th letter shares
a single key letter, so each coset is a Caesar cipher. Try all 26
shifts per coset and pick the most English-looking one.
Recovered key & plaintext
How it works
Kasiski's insight (1863) is purely structural. If the same three
plaintext letters appear twice and happen to line up with the same
three key letters, the ciphertext repeats. The distance between
those repeats is therefore some integer multiple of the key length
L. Collect enough such distances and L
falls out as their greatest common divisor.
Once you know L, the cipher collapses. The 1st, the
(L+1)th, the (2L+1)th… letters of the ciphertext are all encrypted
with the same key letter — i.e. with a single Caesar shift.
So you peel the ciphertext into L independent Caesar
ciphers (called cosets) and brute-force each one against
English letter frequencies, exactly like the
Caesar cracker.
Stitch the winning shifts back together and you have the key.
Friedman's later index of coincidence can confirm
L statistically, but for any reasonably long message
plain Kasiski + chi-squared is enough to read everything in
milliseconds.