Free Tool

Autokey Cipher Tool

A Vigenère cipher whose key never repeats

Ciphertext

How the Autokey cipher works

Autokey works like the Vigenère cipher: each letter is shifted along the alphabet by the value of a key letter (A = 0, B = 1 … Z = 25). The difference is where the key comes from.

  1. Start the key with a short word or phrase, the primer.
  2. When the primer runs out, carry on with the plaintext itself: the first letter of the message, then the second, and so on.
  3. Add each plaintext letter to its key letter to get the ciphertext. Spaces and punctuation are kept and don't use up key letters.

To decrypt, subtract the primer from the first few letters. Each plaintext letter you recover is the key for the letter one primer-length further on.

Example

With the primer QUEENLY, the message ATTACK AT DAWN uses the key QUEENLY followed by ATTAC, the start of the message. The ciphertext is QNXEPV YT WTWP.

How to break it

  • Probable words. Try THE, AND or a word you expect, at every position. Where the guess is right, the key letters it gives are also English, because the key is the message.
  • Try primers. For each primer length, the right primer makes the whole decryption read as English. Short primers can simply be tried one by one.
  • No repeats to find. Kasiski examination and the index of coincidence, which crack Vigenère, don't work here.

History

Girolamo Cardano proposed an early, weak form in the 1550s. Blaise de Vigenère published the strong version in 1586, and this autokey is the cipher he actually invented. The repeating-key cipher now called Vigenère was described earlier by Giovan Battista Bellaso and only later given Vigenère's name.

Related tools

Questions

What is the difference between Autokey and Vigenère?

Vigenère repeats its keyword over and over, and that repetition is what Kasiski examination and the index of coincidence find. Autokey uses the keyword once and then continues with the message itself, so the key never repeats.

Why does one wrong letter spoil the rest of the decryption?

Each decrypted letter becomes part of the key for a later letter. A mistake in the ciphertext, or a wrong primer, carries forward through the whole message.

Can the Autokey cipher be broken?

Yes. Because the key is mostly English text, guessing a common word such as THE at different places reveals readable fragments of the key, and those lead to the primer. A computer can also simply try primers of each length.