Sanjivani Rural Education Society’s
Sanjivani College of Engineering, Kopargaon-423 603
(An Autonomous Institute, Affiliated to Savitribai Phule Pune University, Pune)
NACC ‘A’ Grade Accredited, ISO 9001:2015 Certified
Department of Computer Engineering
(NBA Accredited)
Lecture-02 Substitution Ciphers
Substitution Techniques
• Substitution technique is a classical encryption technique where the
characters present in the original message are replaced by the other
characters or numbers or by symbols.
Substitution Technique:
1.Caesar Cipher
2.Modified Version of Caesar Cipher
3.Monoalphabetic Cipher
4.Homophonic Substitution Cipher
5.Polygram Substitution Cipher
6.Playfair Cipher
7.Hill Cipher
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon 2
1. Caesar Cipher
Caesar cipher
Julius Caesar in 100 B.C
Replace each letter l with (l +3) mod 26
“Attack at dawn” Plain text becomes
Dwwdfn dw gdzq Cipher Text
Two components:
Algorithm: Shift characters by a fixed amount
Key: the fixed amount.
Uniform Scheme of substitution
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon 4
2. Modified Version of Caesar Cipher
It cab be k place down the line this can increase complexity.
Once replacement scheme is decided, it would be constant for
whole PT.
25 possibilities of replacement.
Brute force attack
Solution: use multiple keys
E.g. shift by (3,5,7)
“Attack at dawn” becomes dya dhr dyk dbu
Better, but frequency information still present.
An attacker that knows the block size can separate out
characters encoded with different keys.
Attempt to Break Modified Caesar Cipher
Text Using All Possibilities
3. Monoalphabetic Cipher
• Monoalphabetic cipher is a substitution cipher, where the
cipher alphabet for each plain text alphabet is fixed, for the
entire encryption.
• In simple words, if the alphabet ‘p’ in the plain text is
replaced by the cipher alphabet ‘d’. Then in the entire plain
text wherever alphabet ‘p’ is used, it will be replaced by the
alphabet ‘d’ to form the ciphertext.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon 7
4. Homophonic substitution cipher
To escape frequency analysis, we can use a homophonic
substitution cipher
Map symbols to multiple symbols.
e.g 0 -> {01, 10}, 1->{00,11}
Given Text 011010010 becomes: 011100101101011110
Advantage: -Frequencies Hidden
Disadvantage: -Message and Key are Longer
5. Polygram Cipher
All previous techniques are based on stream cipher.
Polygram is a block cipher.
Following figure shows it
6. Playfair cipher
• In playfair cipher unlike traditional cipher we encrypt a pair
of alphabets(digraphs) instead of a single alphabet.
For the encryption process let us consider the following
example:
Key: monarchy
Plain Text: instruments
The Playfair Cipher Encryption Algorithm:
The Algorithm consists of 2 steps:
• Generate the key Square(5×5):
The key square is a 5×5 grid of alphabets that acts as the key for
encrypting the plaintext. Each of the 25 alphabets must be unique
and one letter of the alphabet (usually J) is omitted from the table
(as the table can hold only 25 alphabets). If the plaintext contains
J, then it is replaced by I.
• Algorithm to encrypt the plain text: The plaintext is split into
pairs of two letters (digraphs). If there is an odd number of
letters, a Z is added to the last letter.
Rules for Encryption:
• If both the letters are in the same column: Take the letter below each one
(going back to the top if at the bottom).
• If both the letters are in the same row: Take the letter to the right of each
one (going back to the leftmost if at the rightmost position).
• If neither of the above rules is true: Form a rectangle with the two letters
and take the letters on the horizontal opposite corner of the rectangle.
• Your cipher text is :gatlmzclrqtx
Playfair Encryption process
7. Hill Cipher
• Hill cipher is a polyalphabetic cipher introduced by Lester Hill in
1929.
• Plain text: Binary
• Key: HILL
• Choose the key in such a way that it always forms a square matrix.
With HILL as the key, we can form a 2×2 matrix.
• Now, plaintext has to form a column vector of length similar to the
key matrix. In our case, the key matrix is 2×2 then the column
vectors of plain text would be 2×1.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon 15
Encryption Process
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon 16
The calculated ciphertext for ‘Binary’ using hill cipher is ‘TVNNZJ’.
DEPARTMENT OF COMPUTER ENGINEERING, Sanjivani COE, Kopargaon 17
THANK YOU