Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Cryptography and Network Security

Section 2

Chapter 2: Classical Encryption Techniques

1
Syllabus
Lab Lab Topics
1 Introduction
2 Classical Encryption techniques I
3 Classical Encryption techniques II
4 DES
5 block cipher operations & 3DES
6 AES
7 Quiz 1
8 Public-Key Cryptography & RSA
9 Hash functions & SHA-512
10 User Authentication (Kerberos)
11 IEEE 802.11 Wireless LAN protocol
2
Substitution Techniques
 Caesar
 Monoalphabetic
 Playfair
 Hill Cipher
 Polyalphabetic

3
A 0
B 1

Caesar Cipher
C 2
D 3
E 4

1. Assign numeric equivalent for each letter F 5


G 6
2. For each P.T letter P substitute with C.T letter C H 7
I 8
where index of C = (index of P + key) mod 26 J 9
K 10
L 11
M 12
Example: P.T = Computer, Key = 8 N 13
O 14
P 15
P.T c o m p u t e r
Q 16
Decryption?
P.T Index 2 14 12 15 20 19 4 17 # of keys ?R 17

C.T Index 10 22 20 23 2 1 1 25 S
Cryptanalysis 18
T 19
2 ?
U 20
C.T K W U X C B M Z V 21
W 22
X 23
Y 24
Z 25

4
a D
b Q

Monoalphabetic Cipher
c E
d P
e R

1. Use any permutation of alphabetic to substitute f S


g F
each letter in the P.T with its corresponding h T

(Mapping) I A
j W
k X
l U

Example: P.T = Computer, Key = this permutation m G


n O
o B
P.T c o m p u t e r
p V
C.T E B G V I M R N Decryption? q H
# of keys ? r N
Cryptanalysis s C
? t M
u I
v Z
w L
x Y
y J
z K

5
Monoalphabetic Cipher

6
Playfair Cipher
 The plaintext message is split into pairs of two
letters (digraphs), and it is based on the use of 5x5
matrix of letters constructed using a keyword.
 If the plaintext has an odd number of characters,
append ‘z’ to the end to make the message of even
length.
 Identify any double letters placed side by side in
the plaintext and replace the second occurrence
with an ‘x’ e.g., ‘hello’ -> ‘he lx lo’.

7
Playfair Cipher
1. The matrix is constructed using the keyword, Example,
keyword = “playfairexample”

2. Plaintext is encrypted as two letters as a time, according to


the following rules:

8
Playfair Cipher
Example: P.T = communication, Keyword = “playfairexample”

Decryption?
P.T co mx mu ni ca ti on # of keys ?
C.T DN IM/ RZ KR DL PB QO Cryptanalysis
JM ?

9
Problems to be discussed
A generalization of the Caesar cipher, known as the affine Caesar cipher, has the
following form: For each plaintext letter , substitute the ciphertext letter :
C = E([a, b], p) = (ap + b) mod 26
because more than one plaintext character maps into the same ciphertext character. The
affine Caesar cipher is not one-to-one for all values of “a”.
For example, a = 2 and b = 3 then ( E([a, b], 0) = E([a, b], 13) = 3 ).
1) Are there any limitations on the value of “b”? Explain why or why not?
No. A change in the value of b shifts the relationship between plaintext letters
and ciphertext letters to the left or right uniformly, so that if the mapping is one-
to-one, it remains one-to-one.
2) Determine which values of “a” are not allowed?
2, 4, 6, 8, 10, 12, 13, 14, 16, 18, 20, 22, 24. Any value of a larger than 25 is
equivalent to a mod 26.

10
Problems to be discussed(Cont.)
How many one-to-one affine Caesar ciphers are there?
There are 12 allowable values of a (1, 3, 5, 7, 9, 11, 15, 17,
19, 21, 23,25).
There are 26 allowable values of b, from 0 through 25).
So, the total number of distinct affine Caesar ciphers is
12*26 = 312.

11
Your Turn … ☺
Encrypt the following P.T = “ Computer Systems” using Playfair
cipher with keyword = “balloon”

12
Package Milestone 1
Deadline: 23rd October 2022
You should implement the following:
Caesar
public string Encrypt(string plaintext, int key)
public string Decrypt(string cyphertext, int key)
public int Analyze(string plaintext, string cyphertext)
Monoalphabetic
public string Encrypt(string plaintext, string key)
public string Decrypt(string cyphertext, string key)
public string AnalyseUsingCharFrequency(string cipher)
Playfair
public string Encrypt(string plaintext, string key)
public string Decrypt(string cyphertext, string key)

13
1

14

You might also like