Autokey Cipher

The Autokey Cipher, invented by Blaise de Vigenère in the 16th century, is a form of polyalphabetic substitution cipher that improves on the traditional Vigenère cipher by incorporating the plaintext itself into the key. This cipher was designed to strengthen encryption by reducing repetitive patterns in the key, making it more resistant to frequency analysis. The concept of the Autokey Cipher builds on Vigenère's previous work and is part of what’s sometimes called the Vigenère family of ciphers. It gained popularity due to its enhanced complexity and its ability to make cryptanalysis more difficult compared to earlier ciphers.

In the Autokey Cipher, the encryption key is generated by appending part of the plaintext to the initial keyword. For example, if the keyword is short, the plaintext itself effectively extends the key, which prevents repeating patterns in the encryption. This method creates a unique and shifting key for each character of the plaintext, ensuring that identical characters in the plaintext do not correspond to the same characters in the ciphertext.

To encrypt a message, the Autokey Cipher uses a Vigenère table or a Caesar shift for each character in the plaintext, with shifts determined by the characters in the key (which is composed of both the keyword and the plaintext). This makes it harder for attackers to detect regularities that could reveal the key or plaintext.

Example

Let’s say the keyword is "KING" and we want to encrypt the plaintext "DEFEND".

  1. Initial Key: KING + DEFEND (plaintext appended).
  2. Resulting Key Sequence: KINGDEF.

Now, encrypt each letter of the plaintext "DEFEND" using the corresponding character in the key sequence.

PlaintextKeyShift (Key Letter)Ciphertext
DK10N
EI8M
FN13S
EG6K
ND3Q
DE4H

So, "DEFEND" encrypted with the keyword "KING" using the Autokey Cipher would yield "NMSKQH" as the ciphertext.