STATION 25 / FIELD MANUAL

← Back to crypto library

Known plaintext

Analysis technique

Known-plaintext analysis uses an independently known message fragment together with its encrypted counterpart to recover information about a key. It is an analysis technique, not a separate encryption algorithm.

When it is useful

A repeated form heading, a quoted original, or a standard response may provide a candidate fragment. It must be aligned with the correct ciphertext positions. A guess that merely looks plausible should still be tested elsewhere.

Worked example: recover an additive key

Suppose CAT is known to have produced FOZ under an alphabetic additive cipher. With A=0, ciphertext equals plaintext plus key, so key equals ciphertext minus plaintext:

Known plaintext  C  A  T
Values           2  0 19
Ciphertext       F  O  Z
Values           5 14 25
Subtract         3 14  6
Recovered key    D  O  G
  1. Align the three known plaintext letters with FOZ.
  2. Subtract 2,0,19 from 5,14,25 modulo 26.
  3. Recover DOG, the three key-stream letters at those positions.

Check the recovery

Add DOG back to CAT: 2+3=5, 0+14=14, 19+6=25 → FOZ. Subtracting DOG from FOZ recovers CAT. These checks verify the arithmetic, not the origin of the known text.

Limits and common mistakes

Recovering three key-stream letters does not prove that DOG repeats throughout the message. If a repeating-key cipher is independently established, test the candidate period on further text. If this is a nonrepeating pad, only the aligned positions are recovered. The subtraction formula here does not apply unchanged to Playfair or transposition ciphers.

  • Vigenère — How an additive repeating key works.
  • Key reuse — How a recovered pad segment can expose a second message.

Useful desk reference

Alphabet positions — Use A=0 to subtract aligned additive key values.

Support this project

Enjoying Advent of Cypher? If you'd like to support the project and help keep it running, you can make a small donation. Completely optional, always appreciated.