Classical Ciphers
Classical ciphers are encryption techniques used historically to conceal information by transforming plaintext into ciphertext using a set of well-defined rules. They are typically symmetric key ciphers, meaning the same key is used for both encryption and decryption. While no longer secure by modern standards, they are foundational to cryptography.
🔐 Types of Classical Ciphers (with Examples)
1. Caesar Cipher (Shift Cipher)
-
Description: Each letter in the plaintext is shifted by a fixed number of positions down the alphabet.
-
Key: The number of positions to shift.
Example:
Plaintext: HELLO
Shift: +3
Encryption:
H → K, E → H, L → O, L → O, O → R
Ciphertext: KHOOR
Decryption: Reverse the shift (–3): KHOOR → HELLO
2. Atbash Cipher
-
Description: A substitution cipher where each letter is replaced by its mirror image in the alphabet. (A ↔ Z, B ↔ Y, ..., M ↔ N)
-
Key: None (fixed transformation)
Example:
Plaintext: HELLO
Encryption:
H → S, E → V, L → O, L → O, O → L
Ciphertext: SVOOL
3. Affine Cipher
-
Description: Uses mathematical functions to encrypt. Each letter is mapped using:
E(x) = (ax + b) mod 26
where x is the letter index (A = 0), a and b are keys, and a must be coprime with 26.
Example:
Key: a = 5, b = 8
Plaintext: HELLO
H (7) → (5×7 + 8) mod 26 = 43 mod 26 = 17 → R
E (4) → (5×4 + 8) = 28 mod 26 = 2 → C
L (11) → (5×11 + 8) = 63 mod 26 = 11 → L
O (14) → (5×14 + 8) = 78 mod 26 = 0 → A
Ciphertext: RCLLA
4. Vigenère Cipher
-
Description: A polyalphabetic substitution cipher using a keyword to shift letters.
-
Key: A repeating keyword
Example:
Plaintext: ATTACKATDAWN
Key: LEMON
Repeat key to match length: LEMONLEMONLE
Encrypt:
A+L → L, T+E → X, T+M → F, A+O → O, C+N → P, K+L → V, ...
Ciphertext: LXFOPVEFRNHR
5. Playfair Cipher
-
Description: A digraph (pair-letter) substitution cipher using a 5x5 matrix of letters from a keyword.
-
Key: A 5x5 letter matrix (J is often combined with I)
Example:
Key: MONARCHY
Matrix built from key:
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
Plaintext: HELLO → HE LL OX (pairs padded if needed)
Encrypt using rules:
-
Same row → next right
-
Same column → next down
-
Rectangle → swap columns
Encrypted: HE → DM, LL → SP, OX → ZN
Ciphertext: DMSPZN
6. Rail Fence Cipher
-
Description: A transposition cipher where text is written in a zig-zag pattern across multiple "rails" and read line by line.
Example (2-rail):
Plaintext: HELLO WORLD
Write in zig-zag:
H . L . O . W . R . D
. E . L . . O . L .
Read rows: HLOWRD EL OL → Ciphertext: HLOWRDELLOL
7. Columnar Transposition Cipher
-
Description: Write plaintext in rows under column headers (keyword letters), then read columns in key order.
Example:
Plaintext: HELLO WORLD
Key: ZEBRAS → Alphabetical order of key letters: E(2), B(1), A(0), etc.
Z E B R A S
H E L L O W
O R L D X X
Read columns by alphabetical order of key: A, B, E, R, S, ZAlphabetical order: A (4), B (2), E (1), R (3), S (5), Z (0)
Column order based on sorting: A B E R S Z
Indexes:
- A → index 4
- B → index 2
- E → index 1
- R → index 3
- S → index 5
- Z → index 0
- Column A (index 4): O, X → OX
- Column B (index 2): L, L → LL
- Column E (index 1): E, R → ER
- Column R (index 3): L, D → LD
- Column S (index 5): W, X → WX
- Column Z (index 0): H, O → HO
- Ciphertext: Read columns as per sorted order of key.
✅ Final Ciphertext:
OXLLERLDWXHO
Multiple choice questions (MCQs) on classical ciphers
1. What type of cipher is the Caesar Cipher?
A. Polyalphabetic substitution
B. Monoalphabetic substitution
C. Transposition
D. Asymmetric
Answer: B. Monoalphabetic substitution
Explanation: The Caesar cipher replaces each letter with a fixed shift — the same substitution is applied to every letter → monoalphabetic.
2. What is the ciphertext of "HELLO" using a Caesar cipher with a shift of 3?
A. IFMMP
B. JGNNU
C. KHOOR
D. EBIIL
Answer: C. KHOOR
Explanation: Shift each letter by 3 positions → H → K, E → H, L → O, L → O, O → R → KHOOR.
3. Which cipher uses a keyword and encrypts pairs of letters (digraphs)?
A. Caesar Cipher
B. Vigenère Cipher
C. Atbash Cipher
D. Playfair Cipher
Answer: D. Playfair Cipher
Explanation: The Playfair cipher encrypts two letters at a time using a 5x5 matrix built from a keyword.
4. What is the Atbash cipher equivalent of "GHOST"?
A. TSLHG
B. TSHLG
C. THSLG
D. GHOST
Answer: B. TSHLG
Explanation: Atbash maps A↔Z, B↔Y, ..., G→T, H→S, O→L, S→H, T→G → TSHLG.
5. In a Vigenère Cipher, what is the result of encrypting "ATTACK" with the key "LEMON"?
A. LXFOPV
B. MFGRQY
C. KYSPQW
D. ATTACK
Answer: A. LXFOPV
Explanation: Use key "LEMON" → L, E, M, O, N, L. Then shift:
A+L → L, T+E → X, T+M → F, A+O → O, C+N → P, K+L → V → LXFOPV.
6. The Rail Fence Cipher is an example of what kind of cipher?
A. Substitution
B. Stream
C. Transposition
D. Polyalphabetic
Answer: C. Transposition
Explanation: Rail Fence rearranges the letters' order without changing them — a type of transposition cipher.
7. Which classical cipher uses modular arithmetic in the form E(x) = (ax + b) mod 26?
A. Vigenère
B. Affine
C. Caesar
D. Playfair
Answer: B. Affine
Explanation: The Affine cipher encrypts using a linear equation with modular arithmetic.
8. If a cipher rearranges the position of letters without substituting them, it is a:
A. Substitution cipher
B. Stream cipher
C. Polyalphabetic cipher
D. Transposition cipher
Answer: D. Transposition cipher
Explanation: Transposition ciphers change order, not the actual letters. Examples: Rail Fence, Columnar.
9. In a Columnar Transposition Cipher, which factor determines column order?
A. Ciphertext length
B. Alphabetical order of the key
C. Shift value
D. Number of rows
Answer: B. Alphabetical order of the key
Explanation: The key's letters are ranked alphabetically, and columns are read in that order.
10. Which of these ciphers is the most secure against frequency analysis?
A. Caesar
B. Atbash
C. Vigenère
D. Rail Fence
Answer: C. Vigenère
Explanation: Vigenère uses multiple Caesar ciphers (polyalphabetic), reducing patterns and making frequency analysis harder.