Autokey Cipher

The autokey cipher was presented in 1586 by a French diplomat and alchemist Blaise de Vigenère.


The autokey cipher was used in Europe until the 20th century. Currently it is considered to be easy to break. However, the idea to create key letters based on plaintext letters is used in many modern ciphers.


Similarly to other polyalphabetic substitution ciphers, the autokey cipher algorithm is about changing plaintext letters based on secret key letters. Each letter of the message is shifted along some alphabet positions. The number of positions is equal to the place in the alphabet of the current key letter.

To simplify calculations, one can use a table which contains in subsequent row alphabets with letters shifted along increasingly larger number of positions. The table is called tabula recta and looks like the one below:

tabula recta
Tabula Recta

Unlike in other similar ciphers, after using all of secret key letters, the algorithm doesn't go back to its first letter but starts to take plaintext letters as new key letters.

For example, after encryption two words Opinio communis using the secret key Ab ovo one receives:

    Plaintext:    OPINIOCOMMUNIS
    Ciphertext:    OQWIWCRWZUIPWE

Security of the autokey cipher

Due to avoid repetition of the same secret key letters, the cipher is resistant to attacks based on dividing ciphertext into parts corresponding to subsequent secret key characters. However its weakness is that all key characters create words and sentences which in addition are the same as in plaintext.

To break the cipher, the intruder should try to guess some parts of plaintext (for example trying some common sequences of letters). Comparing them to plaintext allows to receive some characters of the secret key. One should try to find such letters which result in disclosure of correct words among the secret key characters.