Substitution Techniques: Caesar Cipher and Mono-alphabetic Cipher
What is a Substitution Technique?
A Substitution Technique is a classical encryption method in which each character (letter) of the Plain Text is systematically replaced by another letter, number, or symbol to produce the Cipher Text.
💡 Simple Idea:
The positions of the letters stay in the same place, but the identity of each letter changes (like wearing a mask!).
1. Caesar Cipher (Shift Cipher)
The Caesar Cipher is the oldest and simplest substitution cipher in history. It was invented and used by the Roman Emperor Julius Caesar around 50 BC to send secret military messages to his army generals.
How Caesar Cipher Works:
- In the classic Caesar Cipher, each letter in the Plain Text is replaced by a letter that is 3 positions ahead in the English alphabet.
- The alphabet wraps around at the end: after Z, we start again from A.
AbecomesDBbecomesECbecomesF- …
XbecomesAYbecomesBZbecomesC
Mathematical Formula for Generalized Caesar Cipher:
First, assign a number from 0 to 25 to every English letter (A = 0, B = 1, C = 2, ..., Z = 25).
| Letter | A | B | C | D | E | F | G | H | I | J | K | L | M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Number | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| Letter | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Number | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
For any shift key k (where 1 ≤ k ≤ 25):
- Encryption Formula:
Formula: C = E(k, P) = (P + k) mod 26
- Decryption Formula:
Formula: P = D(k, C) = (C - k) mod 26
📝 Solved Example (Exam Favorite):
Question: Encrypt the Plain Text "CYBER" using Caesar Cipher with key k = 3.
Step-by-Step Solution:
C(P = 2): (2 + 3) mod 26 = 5 →FY(P = 24): (24 + 3) mod 26 = 27 mod 26 = 1 →BB(P = 1): (1 + 3) mod 26 = 4 →EE(P = 4): (4 + 3) mod 26 = 7 →HR(P = 17): (17 + 3) mod 26 = 20 →U
- Plain Text:
C Y B E R - Cipher Text:
F B E H U
Weakness of Caesar Cipher (Why is it easy to break?):
- Only 25 Possible Keys: Since there are only 26 letters in English (and shifting by 0 changes nothing), there are only 25 possible keys (k = 1 to 25).
- Vulnerable to Brute-Force Attack: A hacker or a simple computer program can try all 25 shifts in less than a millisecond and immediately spot the readable English sentence!
2. Mono-alphabetic Substitution Cipher
To fix the tiny key-space problem of the Caesar Cipher, cryptographers created the Mono-alphabetic Cipher.
What is a Mono-alphabetic Cipher?
Instead of shifting all letters by a fixed number like +3, a Mono-alphabetic Cipher allows any letter to be mapped to any other unique letter in a completely jumbled order (a random permutation of the 26 letters).
- Mono = Single. It uses a single fixed substitution alphabet for the entire message.
- Once you decide that
Amaps toQ, then everyAin your message will always becomeQ.
Example of a Mono-alphabetic Key Table:
- Plain Alphabet:
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 - Cipher Alphabet:
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
Let’s encrypt "ATTACK" using the table above:
A→QT→ZT→ZA→QC→EK→A- Cipher Text:
QZZQEA
How Many Keys Does Mono-alphabetic Cipher Have?
- The first letter
Acan be replaced by any of the 26 letters. - The second letter
Bcan be replaced by any of the remaining 25 letters, and so on. - Total possible keys = 26! = 26 × 25 × 24 × … × 1 ≈ 4 × 10^26 keys!
- This makes a Brute-Force attack impossible!
Weakness of Mono-alphabetic Cipher (Frequency Analysis Attack):
Even with 4 × 10^26 keys, Mono-alphabetic ciphers are easily broken using Letter Frequency Analysis:
- In any normal English paragraph, certain letters appear much more frequently than others:
Eis the most common letter in English (~12.7% of all letters).- Followed by
T,A,O,I,N,S.
- If a cryptanalyst sees that the letter
Xappears most frequently in the Cipher Text (say 13% of the time), they can easily guess thatXstands forE! Similarly, common 3-letter words like"THE"can be spotted quickly.
3. Comparison: Caesar Cipher vs. Mono-alphabetic Cipher
| Feature | Caesar Cipher | Mono-alphabetic Cipher |
|---|---|---|
| Shift Rule | Uniform fixed shift (+k) for all letters | Random 1-to-1 permutation of all 26 letters |
| Total Possible Keys | Only 25 keys | 26! ≈ 4 × 10^26 keys |
| Brute-Force Attack | Extremely easy to break | Impossible by brute-force alone |
| Main Weakness | Tiny key space | Broken by Letter Frequency Analysis |
💡 DAVV Exam Preparation Tips
5-Mark / 10-Mark Question: “What is a Substitution Cipher? Explain Caesar Cipher and Mono-alphabetic Cipher with examples and state their limitations.”
- Write the Caesar Cipher encryption formula C = (P + k) mod 26 and decryption formula P = (C - k) mod 26.
- Show a clear step-by-step encryption of a word like
"CYBER"or"HELLO".- Mention why Caesar fails (25 keys / Brute-Force) and why Mono-alphabetic fails (Frequency Analysis of English letters like E, T, A).