Autokey Cipher
Encode and decode using the Autokey cipher. A Vigenere variant where the key extends with the plaintext.
How Autokey Works
Key = Primer + Plaintext
Example with primer "KEY" and plaintext "HELLO":
Key: K E Y H E L L O...
Txt: H E L L O
Each plaintext letter extends the key for the next encryption.
Autokey vs Vigenere
- Vigenere: Key repeats (KEYKEYKEYKEY...)
- Autokey: Key = primer + plaintext (KEYHELLO...)
- Advantage: No repeating key pattern to exploit
What is the Autokey Cipher?
The Autokey cipher (also called autoclave cipher) is a polyalphabetic substitution cipher similar to Vigenère. The key difference is that after using the initial keyword (primer), the key continues with the plaintext itself.
How It Works
Encryption
- Start with a short primer (keyword)
- Append the plaintext to the primer to create the full key
- Encrypt using Vigenère method: C = (P + K) mod 26
Example
Primer: KEY, Plaintext: HELLO
- Full key: K E Y H E (primer + plaintext letters)
- H + K = R, E + E = I, L + Y = J, L + H = S, O + E = S
- Ciphertext: RIJSS
Advantages Over Vigenère
The Autokey cipher improves on Vigenère because:
- No repeating key: Kasiski examination is harder
- Self-extending: Key length equals message length
- More secure: Pattern analysis is more difficult
Autokey in Geocaching
This cipher appears in puzzles because:
- Less common: Many try Vigenère first
- Short primers: Only need a short keyword hint
- Historical: Invented by Blaise de Vigenère himself
- Moderate difficulty: Harder but still solvable
Breaking the Cipher
Without the primer:
- Known plaintext: If you know any words, derive the key
- Primer guessing: Try common short words
- Statistical attack: Analyze letter distributions
- Crib dragging: Test likely plaintext words
History
The Autokey cipher was described by Blaise de Vigenère in 1586, though a simpler version was proposed by Giovan Battista Bellaso in 1564. Vigenère's improvement was to use the plaintext rather than the ciphertext to extend the key.