Classical cryptography refers to encryption methods used before computers. These ciphers are:
- Symmetric (same key for encryption and decryption)
- Character-based (operate on letters, not bits)
- Historically important but mostly insecure today
Shift each letter in the plaintext by a fixed number of positions in the alphabet.
Key:
where:
-
$C$ = ciphertext letter position -
$P$ = plaintext letter position -
$K$ = key (shift amount)
Shift the ciphertext letter backward by
Plaintext: HELLO
Key:
Encryption:
- H (7) → (7 + 3) mod 26 = 10 → K
- E (4) → (4 + 3) mod 26 = 7 → H
- L (11) → (11 + 3) mod 26 = 14 → O
- L (11) → (11 + 3) mod 26 = 14 → O
- O (14) → (14 + 3) mod 26 = 17 → R
Ciphertext: KHOOR
!!! danger "Completely insecure!" - Only 26 possible keys - Brute force: Try all 26 shifts in seconds - Frequency analysis: Letter 'E' is most common in English
Use a keyword to create multiple Caesar shifts.
Key: A word (e.g., "KEY")
Each letter of the key determines the shift for the corresponding plaintext letter.
where:
-
$K_i$ = key letter at position$i$ (repeats cyclically)
Plaintext: HELLO
Key: KEY (repeated: KEYKE)
| Plaintext | H | E | L | L | O |
|---|---|---|---|---|---|
| Key | K (10) | E (4) | Y (24) | K (10) | E (4) |
| Shift | +10 | +4 | +24 | +10 | +4 |
| Ciphertext | R | I | J | V | S |
Ciphertext: RIJVS
More secure than Caesar, but still breakable:
- Kasiski examination: find repeated patterns to determine key length
- Frequency analysis: once key length is known, break each Caesar cipher separately
- Index of coincidence: statistical method to find key length
Each plaintext letter maps to a different ciphertext letter (one-to-one mapping).
Key: A permutation of the alphabet
Key mapping:
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
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
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
Plaintext: HELLO
Ciphertext: ITSSG
Key space:
But still vulnerable to:
- Frequency analysis: 'E' is most common, 'TH' is common bigram
- Pattern analysis: double letters (LL, SS) reveal structure
- Known plaintext attacks
Use a random key that is:
- As long as the message
- Used only once
- Truly random
(XOR each bit of plaintext with corresponding key bit)
Perfectly secure! (Shannon proved this)
Why it's perfect:
- Every ciphertext is equally likely
- No frequency analysis possible
- No patterns to exploit
Why we don't use it:
- Key must be as long as the message
- Key must be truly random
- Key can only be used once
- Key distribution is hard
Write the plaintext in a zigzag pattern across multiple "rails," then read off row by row.
Plaintext: HELLOWORLD
H . L . O . O . L .
. E . L . W . R . D
Ciphertext: HLOOLELDWR
Plaintext: HELLOWORLD
H . . . O . . . L .
. E . L . W . R . D
. . L . . . O . . .
Ciphertext: HOLELLWRDO
Very weak:
- Only a few possible configurations
- Easy to recognize zigzag patterns
- Provides almost no security
Uses a 5×5 grid of letters (I and J share a cell).
Key: A keyword fills the grid, then remaining letters
Keyword: MONARCHY
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Encrypt pairs of letters (digraphs):
- Same row: Shift right (wrap around)
- Same column: Shift down (wrap around)
- Rectangle: Swap with letter in same row
Stronger than simple substitution:
- Operates on digraphs (26² = 676 possibilities)
- Frequency analysis is harder
Still breakable:
- Digraph frequency analysis
- Common pairs: TH, HE, AN
Uses matrix multiplication modulo 26.
Key: An invertible
where:
-
$K$ = key matrix -
$P$ = plaintext vector -
$C$ = ciphertext vector
Key matrix: $$K = \begin{bmatrix} 3 & 3 \ 2 & 5 \end{bmatrix}$$
Plaintext: HE = [7, 4]
Ciphertext: HI
Requirements:
$\det(K) \neq 0 \bmod 26$ $\gcd(\det(K), 26) = 1$
Stronger against frequency analysis:
- Operates on blocks
- Diffusion through matrix multiplication
Vulnerable to:
-
Known plaintext attack: if you know
$P$ and$C$ , can solve for$K$ - Requires chosen plaintext to break completely
| Cipher | Key Space | Security | Speed | Notes |
|---|---|---|---|---|
| Caesar | 26 | Very weak | Fast | Brute force trivial |
| Vigenère | Weak | Fast | Kasiski/frequency breaks it | |
| Substitution | Weak | Fast | Frequency analysis breaks it | |
| OTP | Infinite | Perfect | Fast | Key management impossible |
| Playfair | Large | Moderate | Medium | Digraph frequency vulnerable |
| Hill | Very large | Moderate | Medium | Known plaintext attack |
| Rail Fence | Small | Very weak | Fast | Pattern recognition breaks it |
- Small key spaces (except OTP and Hill)
- Frequency analysis works on all except OTP
- Pattern preservation - structure leaks information
- No confusion/diffusion (except Hill cipher)
- Known plaintext attacks effective
Modern cryptography learned from classical failures:
- Large key spaces are necessary (but not sufficient)
- Confusion - ciphertext should look random
- Diffusion - change one bit → changes many bits
- Avalanche effect - small input change → large output change
- Computational security vs. information-theoretic security
The security should rely on the key, not on keeping the algorithm secret.
Why this matters:
- Algorithms get reverse-engineered
- "Security through obscurity" always fails
- Public algorithms get more scrutiny and testing
Modern application:
- AES algorithm is public
- RSA algorithm is public
- Security relies entirely on key secrecy