Classical Cryptography Techniques
Substitution and Transposition Methods
Historical Foundations of Modern Cryptography
Classical Cryptography Overview
- Historical Importance: Foundation of modern crypto
- Two Main Types: Substitution and Transposition
- Educational Value: Understanding basic principles
- Security: Weak by modern standards
Substitution Techniques
Definition: Replace elements of plaintext with corresponding elements of ciphertext
Key Principle:
- Each character mapped to different character
- Position remains the same
- Systematic replacement
Caesar Cipher
Method: Shift each letter by fixed number of positions
Example (Shift = 3):
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: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
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: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
Encryption: C = (P + k) mod 26
Decryption: P = (C - k) mod 26
Decryption: P = (C - k) mod 26
Caesar Cipher Example
Key = 3
Plaintext: HELLO
H → K (H + 3)
E → H (E + 3)
L → O (L + 3)
L → O (L + 3)
O → R (O + 3)
Ciphertext: KHOOR
Plaintext: HELLO
H → K (H + 3)
E → H (E + 3)
L → O (L + 3)
L → O (L + 3)
O → R (O + 3)
Ciphertext: KHOOR
Monoalphabetic Cipher
Method: Each letter mapped to different letter using random substitution
Example Mapping:
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
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
- Key Space: 26! possible keys
- Weakness: Vulnerable to frequency analysis
Playfair Cipher
Method: Encrypts pairs of letters using 5×5 matrix
Key Matrix (Keyword: MONARCHY):
M O N A R
C H Y B D
E F G I K
L P Q S T
U V W X Z
M O N A R
C H Y B D
E F G I K
L P Q S T
U V W X Z
Rules:
- Same row: take letters to the right
- Same column: take letters below
- Rectangle: take corners horizontally
Vigenère Cipher
Method: Uses keyword to shift letters by different amounts
Example:
Plaintext: HELLO WORLD
Keyword: KEY KEY KEY
Shifts: K=10, E=4, Y=24
H + K = R, E + E = I, L + Y = J, etc.
Ciphertext: RIJVS UIVJH
Plaintext: HELLO WORLD
Keyword: KEY KEY KEY
Shifts: K=10, E=4, Y=24
H + K = R, E + E = I, L + Y = J, etc.
Ciphertext: RIJVS UIVJH
- Strength: Resists frequency analysis
- Weakness: Keyword repetition patterns
Hill Cipher
Method: Uses matrix multiplication for encryption
2×2 Key Matrix:
K = [3 2]
[5 7]
Encryption: C = (K × P) mod 26
K = [3 2]
[5 7]
Encryption: C = (K × P) mod 26
- Advantage: Can encrypt multiple characters at once
- Requirement: Matrix must be invertible
Transposition Techniques
Definition: Rearrange characters of plaintext according to a system
Key Principle:
- Same characters, different positions
- No character substitution
- Pattern-based rearrangement
Rail Fence Cipher
Method: Write message in zigzag pattern, read row by row
Example (3 rails):
Plaintext: HELLO WORLD
H L O O L
E L W R D
L
Ciphertext: HLOOL ELWRD L
Plaintext: HELLO WORLD
H L O O L
E L W R D
L
Ciphertext: HLOOL ELWRD L
Columnar Transposition
Method: Write in grid, read columns in key order
Keyword: ZEBRA (Order: 5-2-1-4-3)
Z E B R A
5 2 1 4 3
W E A R E
D I S C O
V E R E D
Read: Column 1(B), 2(E), 3(A), 4(R), 5(Z)
Ciphertext: ASR EIE EOD REC WDV
Z E B R A
5 2 1 4 3
W E A R E
D I S C O
V E R E D
Read: Column 1(B), 2(E), 3(A), 4(R), 5(Z)
Ciphertext: ASR EIE EOD REC WDV
Route Cipher
Method: Write in grid, read following specific route
Grid:
H E L L O
W O R L D
Routes:
• Spiral clockwise
• Diagonal
• Snake pattern
H E L L O
W O R L D
Routes:
• Spiral clockwise
• Diagonal
• Snake pattern
Substitution vs Transposition
| Feature | Substitution | Transposition |
|---|---|---|
| Operation | Replace characters | Rearrange characters |
| Character Set | Changes | Remains same |
| Frequency Analysis | Vulnerable | Less vulnerable |
| Complexity | Simpler | More complex |
Breaking Classical Ciphers
- Frequency Analysis: Analyze letter frequencies
- Pattern Recognition: Look for common words
- Brute Force: Try all possible keys
- Dictionary Attacks: Use common keywords
Why Classical Ciphers Are Weak
- Small Key Space: Limited number of keys
- Pattern Preservation: Language patterns remain
- No Confusion/Diffusion: Lack modern principles
- Manual Implementation: Error-prone processes
Modern Relevance
- Educational Value: Understanding fundamentals
- Building Blocks: Basis for modern algorithms
- Puzzle Games: Entertainment and learning
- Historical Research: Deciphering old documents
Try It Yourself
Encrypt "ATTACK AT DAWN" using:
1. Caesar cipher (shift = 5)
2. Rail fence (3 rails)
3. Columnar transposition (key = "KEY")
1. Caesar cipher (shift = 5)
2. Rail fence (3 rails)
3. Columnar transposition (key = "KEY")
Answers:
- FYYFHP FY IFBS
- AKTANATA CWT
- TCA KAT ATW
Learning Tools
- Online Simulators: Practice encryption/decryption
- Cryptanalysis Tools: Frequency analyzers
- Historical Examples: Study real cipher cases
- Programming Exercises: Implement algorithms
Key Takeaways
- Classical ciphers use substitution or transposition
- Each method has specific strengths and weaknesses
- All are vulnerable to modern cryptanalysis
- Understanding history helps learn modern crypto
- Simple doesn't mean secure
Remember: These techniques laid the foundation for modern cryptography
Thank You
Questions & Discussion
Next: Modern Hashing Algorithms

