Toolstia / Autokey cipher

Autokey cipher

The autokey cipher is a cousin of the Vigenere cipher that does not repeat its key. It starts with your keyword and then uses the message itself as the rest of the key. Enter a keyword and a message to encrypt it, or paste ciphertext to decrypt it.

The autokey cipher starts with your keyword and then uses the message itself as the rest of the key, so the key never repeats. Only letters are used, and the result is in capitals without spaces.

How it works

  1. Choose encrypt or decrypt.
  2. Enter the keyword.
  3. Type the message or ciphertext and copy the result.

How it works

Each letter is shifted by the matching key letter. The key is the keyword followed by the plaintext letters, so it is as long as the message.

Decrypting

Each recovered plaintext letter is added to the key as you go, which is why the keyword is needed to start.

Why it was an improvement

A repeating key shows patterns that break the Vigenere cipher. The autokey cipher hides those patterns, although it can still be broken with modern methods.

Letters only

Spaces, digits and punctuation are dropped, and the result is in capitals.

Questions

Is autokey secure?

No. It is a classic cipher for puzzles and learning. Everything happens in your browser, and nothing you enter is sent anywhere.

Does the keyword need to be a word?

Any letters work. Non-letters are ignored.

How is it different from Vigenere?

Vigenere repeats the keyword. Autokey continues with the message instead.