The Autokey Cipher is a polyalphabetic substitution cipher designed to reduce the repetition vulnerabilities found in simpler systems such as the Caesar Cipher. Instead of using a short, repeating key, the Autokey Cipher extends the key by appending the plaintext itself after an initial keyword. This produces a variable-length key that is as long as the message, effectively minimizing repeated patterns and increasing resistance to frequency analysis.

The cipher operates on the principle of shifting each plaintext letter by the value of the corresponding key letter. Unlike the Vigenère Cipher, which repeats its keyword cyclically, the Autokey system dynamically incorporates message content, introducing a more complex polyalphabetic sequence that varies with each unique plaintext.

Autokey Cipher: Encoding

To encode a message, first choose a short keyword. Then append the plaintext to the keyword to form the full key. Each plaintext letter is shifted according to the numerical value of the corresponding key letter. For example, using keyword KEY to encrypt “HELLO”:

Plaintext: H  E  L  L  O
Keyword:   K  E  Y  H  E
Numeric:   H=7, E=4, L=11, L=11, O=14
           K=10, E=4, Y=24, H=7, E=4
Shift:     (H+K) mod 26 = 17 → R
           (E+E) mod 26 = 8  → I
           (L+Y) mod 26 = 9  → J
           (L+H) mod 26 = 18 → S
           (O+E) mod 26 = 18 → S

Ciphertext: RIJSS

Notice that after the initial keyword, the plaintext itself contributes to the key, creating a non-repeating sequence and more secure encryption.

Autokey Cipher: Decoding

Decoding requires knowledge of the initial keyword. Each ciphertext letter is reversed by subtracting the corresponding key letter’s value. As letters are recovered, they are appended to the key to continue decryption:

Ciphertext: R  I  J  S  S
Keyword:    K  ?  ?  ?  ?
Decoding:
R-K = 17-10 = 7 → H
I-E = 8-4  = 4 → E
J-Y = 9-24 = 11 → L
S-H = 18-7 = 11 → L
S-E = 18-4 = 14 → O

Plaintext: HELLO

Autokey Cipher: Notes

The Autokey Cipher improves security over simple polyalphabetic systems by eliminating keyword repetition. However, if the initial keyword is discovered, the cipher can be decrypted, similar to vulnerabilities in the Running Key Cipher. It provides a historical example of early attempts to strengthen polyalphabetic encryption and demonstrates the principle of key extension through message content.

Autokey Cipher