Cipher Table

Autokey cipher

Start with a short keyword, then let the message itself carry on as the key. With no repeating pattern, the classic attack on Vigenère has nothing to hold on to.

Key

How the autokey cipher works

Choose a short keyword, called the primer. Write it down, then keep going with the plaintext itself:

Key:     Q U E E N L Y A T T A C
Plain:   A T T A C K A T D A W N
Cipher:  Q N X E P V Y T W T W P

Here the primer is QUEENLY. After those seven letters, the key continues with ATTAC…, the start of the message. Each pair is then combined exactly as in the Vigenère cipher: add the key letter’s position to the plain letter’s.

To decrypt, the receiver uses the primer to recover the first few letters of the message, and those letters become the key for the next few, and so on. The message unlocks itself as it goes.

How to break it

Looking for a repeating key length doesn’t work, because nothing repeats. The attack instead uses the fact that both the message and the key are English.

By hand, the method is crib dragging: guess a common word such as THE or THAT, try it at each position, and see whether the piece of key it implies also looks like English. A correct guess reveals a fragment of message somewhere else, which gives the next clue.

The breaker on this page takes a different road. For each plausible primer length it adjusts the primer one letter at a time, keeping changes that make the whole decryption read more like English.

History

Blaise de Vigenère described this cipher in 1586 in his Traicté des Chiffres. It was a real improvement on the repeating-key cipher that Bellaso had published thirty years before. By an accident of history, Bellaso’s weaker cipher is the one that ended up carrying Vigenère’s name.

Questions people ask

Why is autokey stronger than Vigenère?

A Vigenère key repeats, and that repetition is what attackers exploit. An autokey's key is the primer followed by the message itself, which is as long as the message and never cycles.

What is its weakness?

The key is made of ordinary English. If an attacker guesses a likely word somewhere in the message, they can use it to recover part of the key, which is itself more message, and the solution unravels from there.

What happens if one letter is garbled in transmission?

Every letter after it depends on the letters before, so a single mistake corrupts the rest of the message at intervals of the primer length. This fragility is one reason the cipher was not widely used in the field.