Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Unit 1
1. Information
Security
UNIT 1: SYMMETRIC CIPHER MODEL, CRYPTOGRAPHY, CRYPTANALYSIS
AND ATTACKS; SUBSTITUTION AND TRANSPOSITION TECHNIQUES
REFERENCE BOOK- CRYPTOGRAPHY AND NETWORK SECURITY, PRINCIPLES
AND PRACTICE SIXTH EDITION, WILLIAM STALLINGS, PEARSON
CHAPTER -2 CLASSICAL ENCRYPTION TECHNIQUES
3. Basic Terminology
Plaintext - the original message
Ciphertext – encrypted or the coded message
enciphering (encryption) - The process of converting from
plaintext to ciphertext
Encryption algorithm: performs encryption
Two inputs: a plaintext and a secret key
deciphering (decryption) – process of recovering ciphertext
from plaintext
Decryption algorithm: performs decryption
Two inputs: ciphertext and secret key
Secret key: key used for encryption and decryption
If same key is used then known as symmetric cryptology
If Different key is used then known as asymmetric
cryptology
4. Basic Terminology
Cipher – a particular algorithm (cryptographic system)
cryptography - study of algorithms used in encryption
cryptanalysis (codebreaking) - the study of techniques used in
decryption without knowing plaintext (i.e. he study of the
cryptographic algorithm and the breaking of those secret codes)
cryptology - the field of both cryptography and cryptanalysis
The person practicing Cryptanalysis is called a Cryptanalyst.
It helps us to better understand the cryptosystems and also
helps us improve the system by finding any weak point and thus
work on the algorithm to create a more secure secret code.
For example, a Cryptanalyst might try to decipher a ciphertext
to derive the plaintext. It can help us to deduce the plaintext or
the encryption key.
8. Requirement and Assumption
Requirement
a strong encryption algorithm-given algorithm and cipher
text , attacker can not obtained key or plain text
a shared secret key: Sender and receiver must have
obtained copies of the secret key in a secure fashion and
must keep the key secure.
Y = EK(X)
X = DK(Y)
Assumption
encryption algorithm is known
a secure channel to distribute key
9. Symmetric encryption
Mathematically:
Y = EK(X) or Y = E(K, X)
X = DK(Y) or X = D(K, Y)
X = plaintext
Y = ciphertext
K = secret key
E = encryption algorithm
D = decryption algorithm
Both E and D are known to public
12. Cryptography
Cryptographic systems are characterized along three independent
dimensions:
1. The type of operations used for transforming plaintext to
ciphertext.
All encryption algorithms are based on two general principle:
Substitution - in which each element in the plaintext is
mapped into another element
transposition, in which elements in the plaintext are
rearranged.
The fundamental requirement is that no information be lost.
(i.e., that all operations are reversible).
Most systems, referred to as product systems, involve multiple
stages of substitutions and transpositions
13. Cryptography
Cryptographic systems are characterized along three independent
dimensions:
2. The number of keys used.
If both sender and receiver use the same key, the system is
referred to as symmetric, single-key, secret-key, or conventional
Encryption
If the sender and receiver use different keys, the system is
referred to as asymmetric, two-key, or public-key encryption.
14. Cryptography
Cryptographic systems are characterized along three independent
dimensions:
3. The method used to process plaintext –block cipher, stream
cipher
16. Types of Cryptanalytic Attacks
ciphertext only
know a) algorithm b) ciphertext
known plaintext
know some given plaintext/ciphertext pairs
chosen plaintext
select plaintext and obtain ciphertext
chosen ciphertext
select ciphertext and obtain plaintext
chosen text
select either plaintext or ciphertext to en/decrypt
to attack cipher
17. Types of Cryptanalytic Attacks: Ciphertext only
In the ‘cipher-only’ attack, the attacker knows the ciphertext of
various messages which have been encrypted using the same
encryption algorithm.
The attacker’s challenge is to figure the ‘key’ which can then be
used to decrypt all messages.
Only relatively weak algorithms fail to withstand a ciphertext-
only attack.
18. Types of Cryptanalytic Attacks: Known Plaintext (KPA)
The attacker has a collection of plaintext-ciphertext pairs and is
trying to find the key or to decrypt some other ciphertext that
has been encrypted with the same key.
Example: linear cryptanalysis against block ciphers.
19. Types of Cryptanalytic Attacks: Chosen Plaintext
In this type of attack, the attacker chooses random plaintexts and
obtains the corresponding ciphertexts and tries to find the encryption
key.
Its very simple to implement like KPA but the success rate is quite low.
Example: differential cryptanalysis applied against block ciphers as well
as hash functions.
A popular public key cryptosystem, RSA is also vulnerable to chosen-
plaintext attacks.
20. Types of Cryptanalytic Attacks: Chosen Ciphertext
In this type of attack, the attacker chooses random ciphertexts and
obtains the corresponding plaintexts and tries to find the encryption key.
22. Unconditionally secure algorithm
An encryption scheme is unconditionally secure if the
ciphertext generated by the scheme does not contain enough
information to determine uniquely the corresponding plaintext,
no matter how much ciphertext is available.
That is, no matter how much time an opponent has, it is
impossible for him or her to decrypt the ciphertext simply
because the required information is not there.
With the exception of a scheme known as the one-time pad,
there is no encryption algorithm that is unconditionally secure.
i.e. no matter how much computer power is available, the
cipher cannot be broken since the ciphertext provides
insufficient information to uniquely determine the
corresponding plaintext.
23. Computationally secure algorithm
An encryption scheme is said to be computationally secure if
either of the foregoing two criteria are met.
1. The cost of breaking the cipher exceeds the value of the
encrypted information.
2. The time required to break the cipher exceeds the useful
lifetime of the information.
Unfortunately, it is very difficult to estimate the amount of
effort required to cryptanalyze ciphertext successfully
i.e. given limited computing resources (eg time needed for
calculations is greater than age of universe), the cipher cannot
be broken
24. Brute Force Attack
Try every key to decipher the ciphertext.
On average, need to try half of all possible keys
Time needed proportional to size of key space
Key Size (bits) Number of Alternative
Keys
Time required at 1
decryption/µs
Time required at 106
decryptions/µs
32 232 = 4.3 109 231 µs = 35.8 minutes 2.15 milliseconds
56 256 = 7.2 1016 255 µs = 1142 years 10.01 hours
128 2128 = 3.4 1038 2127 µs = 5.4 1024 years 5.4 1018 years
168 2168 = 3.7 1050 2167 µs = 5.9 1036 years 5.9 1030 years
26 characters
(permutation)
26! = 4 1026 2 1026 µs = 6.4 1012 years 6.4 106 years
26. Substitution techniques
A substitution technique is one in which the letters of plaintext are
replaced by other letters or by numbers or symbols.
If the plaintext is viewed as a sequence of bits, then substitution
involves replacing plaintext bit patterns with ciphertext bit patterns.
A substitution cipher replaces one
symbol with another.
27. Caesar Cipher
The earliest known, and the simplest, use of a substitution
cipher was by Julius Caesar.
The Caesar cipher involves replacing each letter of the alphabet
with the letter standing three places further down the
alphabet.
Note that the alphabet is wrapped around, so that the letter
following Z is A.
30. Caesar Cipher
A shift may be of any amount, so that the general Caesar
algorithm is
where k takes on a value in the range 1 to 25. The decryption
algorithm is simply
31. Caesar Cipher: Example
Use the Caesar cipher with key = 15 to encrypt the message
“hello”.
We apply the encryption algorithm to the plaintext, character by
character:
Solution
32. Caesar Cipher: Example
Use the Caesar cipher with key = 15 to decrypt the message
“WTAAD”.
We apply the decryption algorithm to the plaintext character by
character:
Solution
33. Cryptanalysis of Caesar Cipher
brute-force cryptanalysis is easily performed: simply try all the
25 possible keys.
Three important characteristics of this problem enabled us to
use a brute-force cryptanalysis:
The encryption and decryption algorithms are known.
There are only 25 keys to try.
The language of the plaintext is known and easily
recognizable.
35. Cryptanalysis of Caesar Cipher
Three important characteristics of this problem enabled us to
use a brute-force cryptanalysis:
The encryption and decryption algorithms are known.
There are only 25 keys to try.
The language of the plaintext is known and easily
recognizable.
The third characteristic is also significant. If the language of the
plaintext is unknown, then plaintext output may not be
recognizable.
Furthermore, the input may be abbreviated or compressed in
some fashion, again making recognition difficult.
36. Monoalphabetic Cipher (simple substitution)
A permutation of a finite set of elements S is an ordered sequence
of all the elements of S, with each element appearing exactly
once.
For example, if S = {a, b, c}, there are six permutations of S:
abc, acb, bac, bca, cab, cba
In general, there are n! permutations of a set of n elements,
because the first element can be chosen in one of n ways, the
second in n - 1 ways, the third in n – 2 ways, and so on
37. Monoalphabetic Cipher (simple substitution)
Each plaintext letter maps to a different random ciphertext
letter .
Hence key is 26 letters long
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
“Cipher” line can be any permutation of the 26 alphabetic char
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
38. Monoalphabetic Cipher Security
Now we have a total of 26! 4 x 1026 keys.
With so many keys, it is secure against brute-force attacks.
But not secure against some cryptanalytic attacks.
Problem is language characteristics (frequency analysis of
alphabets)
39. Monoalphabetic Cipher Security-Language Statistics and
Cryptanalysis
Human languages are not random.
Letters are not equally frequently used.
In English, E is by far the most common letter, followed by T, R,
N, I, O, A, S.
Other letters like Z, J, K, Q, X are fairly rare.
In addition to the frequency info of single letters, the frequency
info of two-letter (digram) or three-letter (trigram)
combinations can be used for the cryptanalysis
Most frequent digrams - TH, HE, IN, ER, AN, RE, ED, ON, ES, ST,
EN, AT, TO, NT, HA, ND, OU, EA, NG, AS, OR, TI, IS, ET, IT, AR, TE,
SE, HI, OF
Most frequent trigrams - THE, ING, AND, HER, ERE, ENT, THA,
NTH, WAS, ETH, FOR, DTH
41. Monoalphabetic Cipher Security- Example
Consider the following ciphertext
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
Count the relative letter frequencies
P 13.33 H 5.83 F 3.33 B 1.67 C 0.00
Z 11.67 D 5.00 W 3.33 G 1.67 K 0.00
S 8.33 E 5.00 Q 2.50 Y 1.67 L 0.00
U 8.33 V 4.17 T 2.50 I 0.83 N 0.00
O 7.50 X 4.17 A 1.67 J 0.83 R 0.00
M 6.67
42. Monoalphabetic Cipher Security- Example
Consider the following ciphertext
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
Guess {P, Z} = {e, t}
Of double letters, ZW has highest frequency, so guess ZW = th
and hence ZWP = the
Next, notice the sequence ZWSZ in the first line. We do not
know that these four letters form a complete word, but if they
do, it is of the form th_t. If so, S equates with a.
43. Monoalphabetic Cipher Security- Example
Consider the following ciphertext
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
44. Monoalphabetic Cipher Security- Example
Consider the following ciphertext
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
Proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
direct contacts have been made with political
representatives of the viet cong in moscow
Monoalphabetic ciphers are easy to break because they reflect the frequency
data of the original alphabet
45. To avoid frequency analysis
Two method can used
Encrypt multiple letters of plaintext – Playfair Cipher
Use multiple cipher alphabets – Hill Cipher
46. Playfair Cipher
Not even the large number of keys in a monoalphabetic cipher
provides security.
One approach to improving security is to encrypt multiple
letters at a time.
The Playfair Cipher is the best known such cipher which treats
digrams in the plaintext as single units and translates these units
into ciphertext digrams.
Invented by Charles Wheatstone in 1854, but named after his
friend Baron Playfair.
47. Playfair Cipher
The Playfair algorithm is based on the use of a 5 * 5 matrix of
letters (consider as key).
The matrix is constructed by filling in the letters of the keyword
(Exclude duplicates) from left to right and from top to bottom,
and then filling in the remainder of the matrix with the
remaining letters in alphabetic order. The letters I and J count as
one letter.
key = MONARCHY
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
58. Playfair Cipher- Decrypt Cipher
Cypher text is decrypted two letters at a time, according to the
following rules:
1. If both letters fall in the same row, replace each with the letter
to its left (circularly).
2. If both letters fall in the same column, replace each with the
Letter above it (circularly).
3. if two letter are on different row and column
59. Playfair Cipher- Decrypt Examples
Ciphertext
pitu pmgt uelfgpxg
Key=“engineering”
Plaintext
TEST THIS PROCESSX
61. Playfair Cipher- is it Breakable?
Limitation
Only 25 alphabets are supported.
It does not support numeric characters.
Only either upper cases or lower cases are supported.
The use of special characters (such as blank space, newline,
punctuations, etc.) is prohibited.
It does not support other languages, except English.
Encryption of media files is also not supported.
62. GTU Question
Encrypt the Message “Surgical Strike” with key “GUJAR” using
PLAYFAIR technique. [Winter 2018] [4 Marks]
Explain Playfair Cipher in detail. Find out cipher text for the
following given plain text and key. [Winter 2017] [7 Marks]
Key = GOVERNMENT
Plain text = PLAYFAIR
Use the key “hidden” and encrypt the message “Message” using
playfair cipher. [Summer 2019] [7 Marks]
Explain playfair cipher substitution technique in detail. Find out
cipher text for the following given key and plaintext. [Summer
2017] [7 Marks]
Key = ENGINEERING
Plaintext=COMPUTER
63. GTU Question
Perform encryption in Playfair Cipher algorithm with plain text as
“INFORMATION AND NETWORK SECURITY”, Keyword is
“MONARCHY”. (Note: 1.Put j and i both combine as a single field in
5*5 matrix) [ Winter 2019] [07 Marks]
64. Step1: Read Key and Text
Step2: Remove duplicates from Key
Step3: Convert Key and Text into Uppercase and whenever ‘J’ is
there, it is replace with ‘I’
Step 4: Store temporary those characters in A-Z are not part of
key (KEYMINUS)
Step5: Generate 5X5 matrix by taking output of step 2 and step
4
Step 6: Construct diagram and call playfair function to convert
into Ciphertext
65. for (i = 0; i < strlen(str); i++) {
if (str[i] == 'J') str[i] = 'I';
if (str[i + 1] == '0') playfair(str[i], 'X', key);
else {
if (str[i + 1] == 'J') str[i + 1] = 'I';
if (str[i] == str[i + 1]) playfair(str[i], 'X', key);
else {
playfair(str[i], str[i + 1], key);
i++;
}
}
}
66. Playfair function
Step 1 : Find the position of Diagram into Key matrix
void playfair(char ch1, char ch2, char key[MX][MX]) {
int i, j, w, x, y, z;
for (i = 0; i < MX; i++) {
for (j = 0; j < MX; j++) {
if (ch1 == key[i][j]) { // First char in diagram
w = i;
x = j;
} else if (ch2 == key[i][j]) { // second char in diagram
y = i;
z = j;
}
}
}
67. Playfair function
Step 2 : Both char in Diagram are in same row
if (w == y) {
if(choice==1){
//encryption --same row - move right // change column
x = (x + 1) % 5;
z = (z + 1) % 5;
}
else{
//decryption -- same row - move left
x = ((x - 1)+5)%5;
z = ((z - 1)+5)%5;
}
printf("%c%c", key[w][x], key[y][z]);
}
68. Playfair function
Step 3 : Both char in Diagram are in same Column
else if (x == z) {
if(choice==1){
//encryption --same col - move down //change row
w = (w + 1) % 5;
y = (y + 1) % 5;
}
else{
//Decryption --same col - move Up //change row
w = ((w - 1)+5)%5;
y = ((y - 1) +5)%5;
}
printf("%c%c", key[w][x], key[y][z]);
}
69. Playfair function
Step 4 : Both char in Diagram are not in same row and col
else {
printf("%c%c", key[w][z], key[y][x]);
}
70. Hill Cipher
Hill Cipher was invented and developed in 1929 by Lester S. Hill.
The Hill cipher is an example of a block cipher.
A block cipher is a cipher in which groups of letters are
enciphered together in equal length blocks .
The Hill cipher is a polygraphic substitution cipher built on
concepts from Linear Algebra.
Key is represented in form of matrix (2 x2 or 3x3 , etc..) (Note:
Determinate of Key matrix must be non-zero)
Each letter is represented by number 0 to 25 and calculation are
based on mod 26.
The Hill cipher makes use of modulo arithmetic, matrix
multiplication, and matrix inverses; hence, it is a more
mathematical cipher than others
71. Hill Cipher - Encryption
Encrypting with the Hill cipher is built on the following operation:
C = (K*P) mod 26
Where K is our key matrix and P is the plaintext in vector form.
Matrix multiplying these two terms produces the encrypted
ciphertext.
Example:
Key= HILL
Plaintext=exam
Key Matrix=
Plain Text =
73. Hill Cipher – Encryption-Example -2
Encrypting with the Hill cipher is built on the following operation:
C = (K*P) mod 26
Where K is our key matrix and P is the plaintext in vector form.
Matrix multiplying these two terms produces the encrypted
ciphertext.
Example:
Key= HILL
Plaintext=short example
Key Matrix=
Plain Text: =
74. Hill Cipher – Encryption-Example -2
ciphertext = "APADJ TFTWLFJ".
How to find 275 mod 26?
=275/26
=10.5769
10.5769-10
0.5769x26=15
75. Hill Cipher – Encryption-Example -2
ciphertext = "APADJ TFTWLFJ".
81. Hill Cipher - Encryption
Encrypting with the Hill cipher is built on the following operation:
C = (K*P) mod 26
Where K is our key matrix and P is the plaintext in vector form.
Matrix multiplying these two terms produces the encrypted
ciphertext.
Example:
Key= BKAAUBCPC
Plaintext= retreat now
Key Matrix=
𝑩 𝑨 𝑪
𝑲 𝑼 𝑷
𝑨 𝑩 𝑪
=
𝟏 𝟎 𝟐
𝟏𝟎 𝟐𝟎 𝟏𝟓
𝟎 𝟏 𝟐
Plain Text =
𝒓
𝒆
𝒕
𝒓
𝒆
𝒂
𝒕
𝒏
𝒐
𝒘
𝒙
𝒙
=
𝟏𝟕
𝟒
𝟏𝟗
𝟏𝟕
𝟒
𝟎
𝟏𝟗
𝟏𝟑
𝟏𝟒
𝟐𝟐
𝟐𝟑
𝟐𝟑
87. Hill Cipher – Decryption
Step 1: Calculate the multiplicative inverse for the determinant.
Step 2: Multiply it with Adjoin matrix
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
88. Hill Cipher – Decryption: Example 2x2 Key matrix
Step 1: Calculate the multiplicative inverse for the determinant.
1.1 Find Determinate of the Matrix
Key Matrix =
D=15
89. Hill Cipher – Decryption: Example 2x2 Key matrix
Step 2: Calculate the multiplicative inverse for the determinant.
1.2 Find multiplicative inverse of Determinate of the Matrix
dd-1 1 mod 26
d * d-1 mod 26 =1
= 15 * d-1 mod 26 =1 (Hit and trial Method)
If d-1 = 7 then 15*7 mod 26 = 105 mod 26=1
hence d-1 =7
90. Hill Cipher – Decryption: Example 2x2 Key matrix
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.1 Calculate Adjoin matrix
And for negative values, we have to add them with 26 to get the desired values
between 0 and 25 for use in the decryption formula.
91. Hill Cipher – Decryption: Example 2x2 Key matrix
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.2 Multiply d-1 with Adjoin matrix
92. Hill Cipher – Decryption: Example 2x2 Key matrix
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘ELSC’
93. Hill Cipher Decryption: Example 2
Key: HILL
Ciphertext: APADJ TFTWLFJ
Step 1: Calculate the multiplicative inverse for the determinant.
Step 2: Multiply it with Adjoin matrix
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
94. Hill Cipher – Decryption: Example 2
Step 1: Calculate the multiplicative inverse for the determinant.
1.1 Find Determinate of the Matrix
Key Matrix =
D=15
95. Hill Cipher – Decryption: Example :2
Step 2: Calculate the multiplicative inverse for the determinant.
1.2 Find multiplicative inverse of Determinate of the Matrix
dd-1 1 mod 26
d * d-1 mod 26 =1
= 15 * d-1 mod 26 =1 (Hit and trial Method)
If d-1 = 7 then 15*7 mod 26 = 105 mod 26=1
hence d-1 =7
96. Hill Cipher – Decryption: Example :2
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.1 Calculate Adjoin matrix
And for negative values, we have to add them with 26 to get the desired values
between 0 and 25 for use in the decryption formula.
97. Hill Cipher – Decryption: Example :2
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.2 Multiply d-1 with Adjoin matrix
98. Hill Cipher – Decryption: Example :2
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘APADJ TFTWLFJ’
99. Hill Cipher – Decryption: Example :2
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘APADJ TFTWLFJ’
100. Hill Cipher – Decryption: Example :2
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘APADJ TFTWLFJ’
101. Hill Cipher – Decryption: Example :2
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘APADJ TFTWLFJ’
102. Hill Cipher – Decryption: Example:2
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘APADJ TFTWLFJ’
103. Hill Cipher – Decryption: Example :2
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext as ‘APADJ TFTWLFJ’
Plain text: short example
104. Hill Cipher Decryption: Example 3
Key: CDDG
Ciphertext:FKMFIO
Step 1: Calculate the multiplicative inverse for the determinant.
Step 2: Multiply it with Adjoin matrix
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
105. Hill Cipher – Decryption: Example 3
Step 1: Calculate the multiplicative inverse for the determinant.
1.1 Find Determinate of the Matrix
Key Matrix =
D=3
𝐶 𝐷
𝐷 𝐺
=
2 3
3 6
2 3
3 6
= 2 ∗ 6 − 3 ∗ 3 = 3 𝑚𝑜𝑑 26 = 3
106. Hill Cipher – Decryption: Example :3
Step 2: Calculate the multiplicative inverse for the determinant.
1.2 Find multiplicative inverse of Determinate of the Matrix
dd-1 1 mod 26
d * d-1 mod 26 =1
= 3 * d-1 mod 26 =1 (Hit and trial Method)
If d-1 = 9 then 3*9 mod 26 = 27 mod 26=1
hence d-1 =9
107. Hill Cipher – Decryption: Example :2
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.1 Calculate Adjoin matrix
And for negative values, we have to add them with 26 to get the desired values
between 0 and 25 for use in the decryption formula.
𝑎𝑑𝑗
2 3
3 6
=
6 −3
−3 2
=
6 −3 + 26
−3 + 26 2
=
6 23
23 2
108. Hill Cipher – Decryption: Example :3
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.2 Multiply d-1 with Adjoin matrix
9 ×
6 23
23 2
𝑚𝑜𝑑 26 =
54 207
207 18
𝑚𝑜𝑑 26 =
2 25
25 18
If k =
2 3
3 6
, 𝑡ℎ𝑒𝑛 𝑘−1 =
2 25
25 18
109. Hill Cipher – Decryption: Example :3
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext = ‘FKMFIO’
2 25
25 18
𝐹
𝐾
=
2 25
25 18
5
10
mod 26
=
2 ∗ 5 + 25 ∗ 10
25 ∗ 5 + 18 ∗ 10
mod 26
=
260
305
𝑚𝑜𝑑 26
=
0
19
=
𝐴
𝑇
110. Hill Cipher – Decryption: Example :3
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext = ‘FKMFIO’
2 25
25 18
𝑀
𝐹
=
2 25
25 18
12
5
mod 26
=
2 ∗ 12 + 25 ∗ 5
25 ∗ 12 + 18 ∗ 5
mod 26
=
149
390
𝑚𝑜𝑑 26
=
19
0
=
𝑇
𝐴
111. Hill Cipher – Decryption: Example :3
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
ciphertext = ‘FKMFIO’
2 25
25 18
𝐼
𝑂
=
2 25
25 18
8
14
mod 26
=
2 ∗ 8 + 25 ∗ 14
25 ∗ 8 + 18 ∗ 14
mod 26
=
366
452
𝑚𝑜𝑑 26
=
2
10
=
𝐶
𝐾
113. Hill Cipher Decryption
Key: AHELATPBA
Ciphertext: SYICHOLER
Step 1: Calculate the multiplicative inverse for the determinant.
Step 2: Multiply it with Adjoin matrix
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext
114. Hill Cipher – Decryption: Example
Step 1: Calculate the multiplicative inverse for the determinant.
1.1 Find Determinate of the Matrix
𝐶 𝐷
𝐷 𝐺
=
2 3
3 6
115. Hill Cipher – Decryption: Example
Step 1: Calculate the multiplicative inverse for the determinant.
1.1 Find Determinate of the Matrix
D=11
116. Hill Cipher – Decryption: Example
Step 2: Calculate the multiplicative inverse for the determinant.
1.2 Find multiplicative inverse of Determinate of the Matrix
dd-1 1 mod 26
d * d-1 mod 26 =1
= 11 * d-1 mod 26 =1 (Hit and trial Method)
If d-1 = 19 then 11*19 mod 26 = 209 mod 26=1
hence d-1 =19
117. Hill Cipher – Decryption: Example
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.1 Calculate Adjoin matrix (Method 1)
118. Hill Cipher – Decryption: Example
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.1 Calculate Adjoin matrix (Method 2)
First calculate cofactor matrix
Then transpose the cofactor matrix
119. Hill Cipher – Decryption: Example
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.1 Calculate Adjoin matrix (Using Method 1)
And for negative values, we have to add them with 26 to get the desired values
between 0 and 25 for use in the decryption formula.
120. Hill Cipher – Decryption: Example
Step 2: Multiply multiplicative inverse of the determinant with
adjoin matrix
2.2 Multiply d-1 with Adjoin matrix
121. Hill Cipher – Decryption: Example
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext ciphertext = ‘SYICHOLER’
122. Hill Cipher – Decryption: Example
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext ciphertext = ‘SYICHOLER’
123. Hill Cipher – Decryption: Example
Step 3: Multiple inverse key matrix with Cipher text matrix to
obtain plaintext ciphertext = ‘SYICHOLER’
Plaintext=we are safe
124. Cryptanalysis of Hill Cipher
• As with Playfair, the strength of the Hill cipher is
that it completely hides single-letter frequencies.
Indeed, with Hill, the use of a larger matrix hides
more frequency information.
• Thus, a 3*3 Hill cipher hides not only single-letter
but also two-letter frequency information
• The Hill Cipher's weaknesses to the known-
plaintext attack is considered as its most
important security imperfection since it can be
cracked by taking n distinct pairs of plaintext
and corresponding cipher-text
125. GTU Question
• Encrypt the message "meet me at the usual place " using the Hill
cipher with the key
9 4
5 7
[winter 2018] [7 Marks]
• Given key K=
17 17 5
21 18 21
2 2 19
and plaintext =”ney”. Find out the
ciphertext applying Hill Cipher. [ 7 Marks] [Summer 2019]
• Encrypt the message “GTU Examination” using the Hill cipher
algorithm with the key matrix
5 17
4 15
. Show your calculations
and the result. [Winter 2019] [7 marks]
126.
127.
128.
129.
130.
131.
132. Polyalphabetic Cipher
If two letters are the same in the ciphertext it does not mean
they must decipher to the same plaintext letter.
133. Polyalphabetic Cipher –Vigenere Cipher
One of the simplest, polyalphabetic ciphers is the Vigenère cipher
Method-1
It uses
Vigenere’ table
of size 26 x26
Each row one
shift is made
towards right in
Cyclic Manner
138. Polyalphabetic Cipher –Vigenere Cipher
Decryption is performed by going
to the row in the table
corresponding to the key, finding
the position of the ciphertext
letter in this row, and then using
the column’s label as the
plaintext.
142. Polyalphabetic Cipher –Vigenere Cipher
Method-2
When the vigenere table is not given, the encryption and decryption are done
by Vigenar algebraically formula in this method (convert the letters (A-Z) into
the numbers (0-25)).
It generate Keystream from KEY by repeatedly writing key until length of
keystream and Plaintext/Ciphertext are equal
Encryption
Ci = (Pi + Ki) mod 26
Decryption
Pi = (Ci - Ki) mod 26
144. Polyalphabetic Cipher –Vigenere Cipher
Method-2
Encryption
Ci = (Pi + Ki) mod 26
PLAINTEXT G I V E M O N E Y
06 08 21 04 12 14 13 04 24
KEY L O C K L O C K L
11 14 2 10 11 14 2 10 11
CIPHERTEXT
145. Polyalphabetic Cipher –Vigenere Cipher
Method-2
Encryption
Ci = ( Pi+ Ki) mod 26
PLAINTEXT G I V E M O N E Y
06 08 21 04 12 14 13 04 24
KEY L O C K L O C K L
11 14 2 10 11 14 2 10 11
CIPHERTEXT R W X O X C P O J
146. Polyalphabetic Cipher –Vigenere Cipher
Method-2
Decryption
Pi = (Ci - Ki) mod 26
Ciphertext R W X O X C P O J
17 22 23 14 23 02 15 14 09
KEY L O C K L O C K L
11 14 2 10 11 14 2 10 11
Plaintext G I V E M O N E Y
147. Cryptanalysis of Vigenere Cipher
The Vigenere Cipher initially seems very secure, however it can be
broken fairly easily once the length of the keyword is known.
If we know that the length of the keyword is n, we can break the
ciphertext into n cosets and attack the cipher using frequency
analysis if the ciphertext sample is long enough.
Kasiski tests to determine length of key
148. Cryptanalysis of Vigenere Cipher
Kasiski tests to determine length of key
Example:
The second group of repeated letters IVE occurs 12 letters after the
first.
The third group of letters appears 6 letters after the first.
GCD(6,12) is 6, this suggests that the length of the keyword is 6.
Plaintext T H E C H I L D I S F A T H E R O F T H E M A N
Keyword P O E T R Y P O E T R Y P O E T R Y P O E T R Y
Ciphertext I V E V Y G A R M L M Y I V E K F D I V E F R L
149. Cryptanalysis of Vigenere Cipher
The periodic nature of the keyword can be eliminated by using a
nonrepeating keyword that is as long as the message itself.
Vigenère proposed what is referred to as an autokey system, in
which a keyword is concatenated with the plaintext itself to
provide a running key.
For our example,
Even this scheme is vulnerable to cryptanalysis.
Because the key and the plaintext share the same frequency
distribution of letters, a statistical technique can be applied.
key: deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
150. Vernam Cipher
The Vernam cipher was created by Gilbert Vernam
Keyword is long as the plaintext (has no statistical relationship
with plaintext)
The essence of this technique is the means of construction of the
key.
Vernam proposed the use of a running loop of tape that eventually
repeated the key, so that in fact the system worked with a very
long but repeating keyword.
Each character of the plaintext and the key is converted to binary
using a character coding system like ASCII.
The plaintext binary is then XOR'd with the key binary to produce a
new binary value.
This is then converted to a character and is part of the ciphertext.
The same technique is applied in reverse to decrypt information.
155. Vernam Cipher
Although such a scheme, with a long key, presents formidable
cryptanalytic difficulties, it can be broken with sufficient
ciphertext, the use of known or probable plaintext sequences, or
both.
Solution: One- Time Pad
156. One Time Pad
An Army Signal Corp officer, Joseph Mauborgne, proposed an
improvement to the Vernam cipher that yields the ultimate in
security.
Mauborgne suggested using a random key that is as long as the
message, so that the key need not be repeated.
In addition, the key is to be used to encrypt and decrypt a single
message, and then is discarded,
Each new message requires a new key of the same length as the
new message. Such a scheme, known as a one-time pad, is
unbreakable.
It produces random output that bears no statistical relationship to
the plaintext.
163. Rail Fence Transposition - Decryption
Ciphertext: MEMATEAKETETHPR
Create a table
Number of column = number of letter in Ciphertext
Number of row = depth
Put X in Zig Zag fashion
X X X X X X X X
X X X X X X X
164. Rail Fence Transposition - Decryption
Ciphertext: MEMATEAKETETHPR
Now, write down Ciphertext, row by row where X is written
Then, write down letter in Zig-Zag fashion
Plaintext: MEETMEATTHEPARK
M E M A T E A K
E T E T H P R
165. Rail Fence Transposition - Example
Ciphertext: HORELOLLWD
Plaintext: THIS IS A QUICK WAY TO MIX
Depth: 3
Ciphertext: TIUWOHSSQIKATMXIACYI
Plaintext: Hello World
Depth: 3
167. Row/Column Transposition
Plaintext is written in tabular form row by row where length of row
determined by length of key.
Ciphertext is read out column by column where order of column is
specified by Key.
Key = permutation of order of Column
Example:
Key=ZEBRAS (the key is 6 letters long hence there are 6 column in
Plaintext table)
171. Row/Column Transposition-Encryption
In this example, the key is 4312567. To encrypt, start with the column that is labeled
1, in this case column 3. Write down all the letters in that column. Proceed to column
4, which is labeled 2, then column 2, then column 1, then columns 5, 6, and 7
172. Cryptanalysis of Row/Column Transposition
For columnar/Row transposition, cryptanalysis is fairly straightforward and
involves laying out the ciphertext in a matrix and playing around with column
positions.
Digram and trigram frequency tables can be useful.
Solution: Multiple transposition
173. Double Row/Column Transposition
The transposition cipher can be made significantly more secure by performing
more than one stage of transposition.
The result is a more complex permutation that is not easily reconstructed.
1st level
transposition
2nd level
transposition
174. Double Row/Column Transposition
To visualize the result of this double transposition, designate the letters in the
original plaintext message by the numbers designating their position.
Thus, with 28 letters in the message, the original sequence of letters is.
After the first transposition, we have
which has a somewhat regular structure. But after the second transposition,
we have
This is a much less structured permutation and is much more difficult to
cryptanalyze.