Autokey Cipher

A Vigenère-style cipher where the key extends using plaintext (or ciphertext) rather than repeating.

Family: Polyalphabetic substitution (Vigenère variant) Era: Classical (19th century variants; common in puzzles) Strength: Weak–medium (crib-sensitive)

History & context

Autokey was designed to fix a major weakness of Vigenère: repeating keys create periodic patterns that reveal the key length (Kasiski/IoC). Autokey reduces repetition by extending the keystream using text itself. In puzzle cryptography, Autokey is popular because it’s one step harder than Vigenère but still crackable when you have a crib, a known header, or predictable plaintext structure.

How Autokey Cipher works

Plaintext-autokey (common): • Keystream = KEYWORD + PLAINTEXT (then truncated to message length) • Encrypt: C[i] = (P[i] + K[i]) mod 26 • Decrypt: P[i] = (C[i] - K[i]) mod 26, but K after the seed depends on recovered plaintext This creates a feedback loop: once you recover some plaintext, you recover more of the keystream automatically.

Core rules

Worked example

Seed key: KEY Plaintext: ATTACKATDAWN Keystream: KEYATTACKATDA (seed + plaintext, truncated) Encrypt using Vigenère arithmetic with this keystream.

How to encode / decode

Step-by-step

  1. Pick a seed keyword (letters only).
  2. Normalize plaintext/key rules (uppercase, letters-only advancement).
  3. Build keystream = seed + plaintext (truncate to length).
  4. Encrypt each letter like Vigenère using the matching keystream letter.
  5. Preserve or strip punctuation consistently with your chosen convention.
💡 Tip: Autokey variants differ. The big question: does the keystream extend with plaintext or ciphertext, and does it advance over punctuation? Make sure your tool and your puzzle use the same convention.

How to break a Autokey Cipher

Autokey is harder than repeating-key Vigenère because the usual key-length attacks weaken. The most practical break is a **crib attack**: guess a likely plaintext word/phrase, then use it to bootstrap the keystream. Once the guess is correct, decryption rapidly becomes self-sustaining because recovered plaintext generates more keystream.

Practical checklist

What frequency looks like

Autokey often looks less periodic than Vigenère because the keystream changes with plaintext. IoC and Kasiski can be less decisive. Frequency analysis is more of a triage tool here: it tells you it’s classical/polyalphabetic, but cribs do the heavy lifting.

Signals to look for:
  • Less clear repeating structure than Vigenère with short repeating key.
  • Still alphabetic and language-linked (not random bytes).
  • If you try Vigenère key-length scans and nothing clean appears, Autokey is a suspect.
  • Crib success produces a strong ‘snowball’ effect in readability.

Mini example

Try guessing the plaintext contains 'THE' near the start. If that guess produces readable continuation (not just a single word), you likely found the right alignment.

Common mistakes

Variants

Practice

Practice by encrypting with a short seed like 'KEY', then try breaking it by guessing 'THE' or a known header near the start.

Try these prompts

FAQ

Because it reduces repeating-key periodicity, weakening key-length detection.
Cribs. A correct guessed word can bootstrap the keystream and snowball into full recovery.
Usually punctuation is preserved, but key advancement rules vary by implementation.