0% found this document useful (0 votes)
30 views28 pages

04 - Lec03 - Cryptography 03

This document provides an overview of traditional cryptographic systems and ciphers used before modern cryptography. It discusses symmetric key encryption schemes and describes several early ciphers including substitution ciphers and transposition ciphers. Specifically, it details the Caesar cipher and Playfair cipher. The Caesar cipher involves shifting letters of the alphabet by a key value. The Playfair cipher encrypts letters in pairs using a 5x5 grid generated from a keyword. The document provides examples of encrypting and decrypting messages with these classical ciphers.

Uploaded by

ashokabc2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views28 pages

04 - Lec03 - Cryptography 03

This document provides an overview of traditional cryptographic systems and ciphers used before modern cryptography. It discusses symmetric key encryption schemes and describes several early ciphers including substitution ciphers and transposition ciphers. Specifically, it details the Caesar cipher and Playfair cipher. The Caesar cipher involves shifting letters of the alphabet by a key value. The Playfair cipher encrypts letters in pairs using a 5x5 grid generated from a keyword. The document provides examples of encrypting and decrypting messages with these classical ciphers.

Uploaded by

ashokabc2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Information Security

CCS 1306

Kasunika Guruge
Lecturer (P)
School of IT & Computing
SLTC Research University
Information Security
CCS 1306

Cryptography III (Traditional Ciphers)


Earlier Cryptographic Systems
● Before proceeding further, you need to know some facts about historical
cryptosystems −
○ All of these systems are based on symmetric key encryption scheme.
○ The only security service these systems provide is confidentiality of information.
○ Unlike modern systems which are digital and treat data as binary numbers, the earlier
systems worked on alphabets as basic element.

● These earlier cryptographic systems are also referred to as Ciphers. In


general, a cipher is simply just a set of steps (an algorithm) for performing
both an encryption, and the corresponding decryption.

3
Earlier Cryptographic Systems
● Following are some of the earlier ciphers that was used before the
cryptographic algorithms based on the computers.
○ Substitution Ciphers
○ Transposition Ciphers
○ Rotor Machine

● The modern crypto systems are more complex, but the philosophy
remains the same. The primary change is that the modern algorithms
works on bits instead of characters.

4
Substitution Ciphers
● A substitution cipher is a type of cryptographic algorithm where the
letters of plaintext are replaced/substituted by other characters.
● The receiver inverts the substitution on the ciphertext to recover the
plaintext.
● In classical cryptography, there are four types of substitution ciphers.
○ Simple substitution cipher or Monoalphabetic cipher
○ Homophonic substitution cipher
○ Polygram substitution cipher
○ Polyalphabetic substitution cipher
5
1. Simple Substitution / Monoalphabetic Cipher
● Each character in the plaintext is replaced with a corresponding character
of ciphertext.

● Example – Caesar cipher


○ Earliest known substitution cipher introduced by Julius Caesar
○ Used mainly for the military communications
○ This cryptosystem is generally referred to as the Shift Cipher. The concept is to
replace each alphabet by another alphabet which is ‘shifted’ by some fixed number
between 0 and 25.

6
Caesar Cipher
● For this type of scheme, both sender and receiver agree on a ‘secret shift
number’ for shifting the alphabet. This number which is between 0 and 25
becomes the key to encryption.
● The name ‘Caesar Cipher’ is occasionally used to describe the shift cipher
when the ‘shift of three’ is used.

Shift = key = 3
7
Caesar Cipher
● Mathematically a shift cipher can be interpreted as below.

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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

c = E(k, p) = (p + k) mod (26)  Encryption


p = D(k, c) = (c - k) mod (26)  Dercryption

C – Numeric value of ciphertext.


P – Numeric value of plaintext.
K – key
E(k,p) – Encryption Algorithm
D(k,c) – Decryption Algorithm 8
Caesar Cipher
● Example: Encrypt the plaintext ‘CREATE’ using Caesar cipher

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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

c = E(k, p) = (p + k) mod (26)  Encryption

Plaintext C → (3 + 3) mod (26) = 6 → ciphertext = F


Plaintext R → (18 + 3) mod (26) = 21 → ciphertext = U
Plaintext E → (5 + 3) mod (26) = 8 → ciphertext = H
Plaintext A → (1 + 3) mod (26) = 4 → ciphertext = D
Plaintext T → (20 + 3) mod (26) = 23 → ciphertext = W
Plaintext E → (5 + 3) mod (26) = 8 → ciphertext = H
9
Caesar Cipher
● Example: Decrypt the ciphertext ‘FDNH’. (Encrypted using Caesar cipher)

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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

p = D(k, c) = (c - k) mod (26)  Decryption

Ciphertext F → (6 - 3) mod (26) = 3 → plaintext = C


Ciphertext D → (4 - 3) mod (26) = 1 → plaintext = A
Ciphertext N → (14 - 3) mod (26) = 11 → plaintext = K
Ciphertext H → (8 - 3) mod (26) = 5 → plaintext = E

10
Exercise

● Decrypt the following ciphertext. (Hint: Encryption algorithm used is Caesar


Cipher)
HDVB WR EUHDN

● Decrypt the following ciphertext. (Hint: key=5)


YMJ VZNHP GWTBS KTC OZRUX TAJW YMJ QFED ITL

● Encrypt the following (Use Caesar Cipher)


Meet me near the school

11
2. Polygram Substitution Cipher
● A Polygram substitution cipher is one in which blocks of characters are
encrypted in groups. Ex: ‘ABA’ could correspond to ‘RTQ’.
● Example: Playfair Cipher
○ Invented by Charles Wheatstone in 1854 and named after his friend Baron Playfair.
○ Two letters are encrypted at once, therefore it is called bigram substitution cipher.

● Security is much improved than simple substitution cipher.


● This cipher was widely used for many years by US and British military in
WW1.

12
Playfair Cipher - Encryption
There are 02 steps:
● Step 01: Generate key square (5x5)
○ 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.
○ Select a key word and fill it in the 5x5 grid and fill the remaining letters of the
alphabet in the grid in the alphabetic order as shown in the diagram.
M O N A R
Example: using the keyword ‘monarchy’ , thus the initial C H Y B D
entries are ‘m’, ‘o’, ‘n’, ‘a’, ‘r’, ‘c’, ‘h’ and ‘y’ . Followed by E F G I/J K
remaining characters from a z in alphabetic order. 'J' is L P Q S T
replaced with 'I' to fit 5x5 square.
U V W X Z 13
Playfair Cipher - Encryption
There are 02 steps:
● Step 02: Split the plaintext into pair of letters.
○ If there is an odd number of letters, a ‘Z’ is added to the last letter.
Ex: Plaintext → INSTRUMENTS
After split → IN ST RU ME NT SZ
○ If a pair has repeated letters insert ‘Z’ in the middle.
Ex: Plaintext → STRESS
M O N A R
After split → ST RE SZ SZ
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
14
Playfair Cipher - Encryption
Rules for encryption:
● Rule 01: if both letters are in the same column, take the letter below each one.
(going back to the top if at the bottom)
Ex: Plaintext digraph → ME
Encrypted text → CL

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
15
Playfair Cipher - Encryption
Rules for encryption:
● Rule 02: if both letters are in the same row, take the letter to the right of each
one. (going back to the leftmost if at the rightmost)
Ex: Plaintext digraph → ST
Encrypted text → TL

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
16
Playfair Cipher - Encryption
Rules for encryption:
● Rule 03: if neither of the above rule is true, form a rectangle with two letters
and take the letters on the horizontal opposite corner of the rectangle.
Ex: Plaintext digraph → RQ
Encrypted text → NT

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
17
Playfair Cipher - Encryption

18
Playfair Cipher - Encryption
● Plaintext: Instruments → Instrumentsz → ‘In’ ‘st’ ‘ru’ ‘me’ ‘nt’ ‘sz’
● Ciphertext: gatlmzclrqtx
I→g
n→a
s→t
t→l
r→m
u→z
m→c
e→l
n→r
t→q
s→t
z→x
19
Playfair Cipher - Decryption
● For the decryption of Playfair Cipher, you need to have the same 5x5 grid
you used in the encryption.

● Step 01: Generate key square (5x5)


● Step 02: : Split the ciphertext into pair of letters (digrams).
Example: Ciphertext -“gatlmzclrqtx”
After split -'ga' 'tl' 'mz' 'cl' 'rq' 'tx' 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
20
Playfair Cipher - Decryption
Rules for decryption:
● Rule 01: if both letters are in the same column, take the letter above each one.
(going back to the bottom if at the top)
Ex: Encrypted digraph → CL
Plaintext → ME

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
21
Playfair Cipher - Decryption
Rules for decryption:
● Rule 02: if both letters are in the same row, take the letter to the left of each
one. (going back to the rightmost if at the leftmost)
Ex: Encrypted digraph → TL
Plaintext → ST

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
22
Playfair Cipher - Encryption
Rules for encryption:
● Rule 03: if neither of the above rule is true, form a rectangle with two letters
and take the letters on the horizontal opposite corner of the rectangle.
Ex: Encrypted digraph → NT
Plaintext → RQ

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
23
Playfair Cipher - Decryption

24
Playfair Cipher - Decryption
● Ciphertext: gatlmzclrqtx → ‘ga’ ‘tl’ ‘mz’ ‘cl’ ‘rq’ ‘tx’
● Plaintext: Instrumentsz → Instruments
ga → in
tl → st
mz → ru
cl → me
rq → nt
tx → sz

25
Playfair Cipher
● Security is much improved with the Playfair cipher over the monoalphabetic
ciphers.

● Have 26x26 = 676 digrams to analyze. Caesar cipher only had 26 characters to
analyze

26
3. Polyalphabetic Substitution Ciphers
● A polyalphabetic substitution cipher is made up of multiple simple substitution
ciphers or you can say that it uses multiple alphabets when encrypting.

● Example for a polyalphabetic substitution cipher – Vigenère Cipher


•The simplest polyalphabetic substitution cipher.
•Makes the cryptanalysis harder with more alphabets to guess.

● Case study: Find how the encryption and decryption steps of Vigenère cipher.

27
QUESTIONS?

Thank You!

28

You might also like