04 — Classical
Simple Substitution Cipher
Monoalphabetic — each plaintext letter maps to exactly one ciphertext letter.
Formal definition
Let Σ = {A..Z}. The key is a permutation π on Σ. Encryption and decryption:C_i = π(P_i) # look up substitution row
P_i = π⁻¹(C_i) # invert the permutation
Mechanism
The key is a permutation of the 26-letter alphabet. Each plaintext letter is replaced by its mapped counterpart.
Plaintext : A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Ciphertext: Q W E R T Y U I O P A S D F G H J K L Z X C V B N M
E.g. HELLO → ITSSG
WORLD → VKXZE
Properties
- Keyspace = 26! ≈ 4 × 10²⁶ ≈ 2⁸⁸ — too large for 19th-century brute force:log₂(26!) = Σ log₂(k) ≈ 88.4 bits
- But each letter always maps to the same letter — pattern leaks
- Word boundaries, doubled letters, digraph frequencies all preserved
Attack: Frequency Analysis — worked
English letter frequencies are highly non-uniform:
| Letter | E | T | A | O | I | N | S | H | R |
|---|---|---|---|---|---|---|---|---|---|
| Freq % | 12.7 | 9.1 | 8.2 | 7.5 | 7.0 | 6.7 | 6.3 | 6.1 | 6.0 |
Count. Tally each ciphertext letter. Suppose
S appears 14%, X 9%, A 8% — well above the ~3.8% uniform average.Map singles. Guesses:
S→E, X→T, A→A/O. Single-letter words must be A or I — huge constraint.Use digraphs & doubles. Most common digraphs TH, HE, IN; most common doubles LL, EE, SS, OO. If
SS appears doubled often, S is likely E/L/O. common words. Try
THE pattern: a 3-letter word with pattern X?? appearing 5× is almost certainly THE — solving 3 letters at once.Cipher breaks with ~25–50 letters of ciphertext. Big keyspace is irrelevant — the statistics of English do the work.
Verdict
Computationally trivial today. Historical importance: it set up the problem that Vigenère and Playfair tried to solve.Exam one-liner: 26! looks strong, but monoalphabetic = frequency preserved = broken by counting.