Lecture#02 Part 1 - Classical Encryption Techniques
Lecture#02 Part 1 - Classical Encryption Techniques
Lecture#02
Classical Encryption Techniques
Course: Cryptography & Network Security (CE-408)
Course Teacher: Ms. Rukaiya
Contact Info:
Email: [email protected]
1
Definitions
• PLAINTEXT: An original message
• CIPHERTEXT: A coded/unintelligent/transformed/scrambled message
• ENCIPHERING/ENCRYPTION: The process of converting from
plaintext to ciphertext.
• DECIPHERING/DECRYPTION: Restoring the plaintext from the
ciphertext
• CRYPTOGRAPHY: The area of study of many schemes used for
encryption (crypto – secret graphy – writing)
• CRYPTOGRAPHIC SYSTEM/CIPHER: A scheme used for encryption
process
• CRYPTANALYSIS: Techniques used for deciphering a message without
any knowledge of the enciphering details (“breaking the code”)
• CRYPTOLOGY: The areas of cryptography and cryptanalysis
2
Figure: Simplified Model of Symmetric Encryption
3
Symmetric Cipher Model
4
^
X
Cryptanalyst
^
K
Secure Channel
Key
Source
5
Cryptographic Systems
• Characterized along three independent dimensions
Symmetric,
single-key,
Substitution secret-key, Block cipher
conventional
encryption
Asymmetric,
two-key, or
Transposition Stream cipher
public-key
encryption
6
Cryptanalysis and Brute-force Attack
Cryptanalysis
• Attack relies on the nature of the algorithm plus some knowledge
of the general characteristics of the plaintext
Brute-force attack
• Attacker tries every possible key on a piece of ciphertext until
an intelligible translation into plaintext is obtained
7
Types of Attacks on Encrypted Messages
8
Encryption Scheme Security
• The users of an encryption algorithm can strive for is an
algorithm that meets following criteria:
• Unconditionally secure
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
• Computationally secure
The cost of breaking the cipher exceeds the value of the
encrypted information
The time required to break the cipher exceeds the useful
lifetime of the information
E.g., OTP (One Time Pad)
9
Brute-Force Attack
10
Key Strength
11
Strong Encryption
• It refers to encryption schemes that make it impractically difficult
for unauthorized persons or systems to gain access to plaintext
that has been encrypted
12
Classical Cryptographic
Techniques
13
Substitution Technique
14
Caesar Cipher
Example:
plain: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB
16
Caesar Cipher
Activity #01:
plain: SSUET
cipher: ?????
Activity #02:
cipher: L FDPHL VDZL FRQTXHUHG
plain: ??????
17
Brute-force Cryptanalysis of Caesar Cipher
PHHW PH DIWHU WKH WR JD SDUWB
KEY
1 oggv og chvgt vjg vqic rctva
2 nffu nf bgufs uif uphb qbsuz
3 meet me after the toga party
4 ldds ld zesdq sgd snfz ozqsx
5 kccr kc ydrcp rfc rmey nyprw
Three important characteristics of this 6 jbbq jb xcqbo qeb qldx mxoqv
7 iaap ia wbpan pda pkcw lwnp u
problem enabled us to use a brute-force
8 hzzo hz vaozm ocz ojbv kvmot
cryptanalysis: 9 gyyn gy uznyl nby niau julns
10 fxxm fx tymxk max mhzt itkmr
1. The encryption and decryption algorithms 11 ewwl ew sxlwj lzw lgys hsjlq
are known. 12 dvvk dv rwkvi kyv kfxr grikp
2. There are only 25 keys to try. 13 cuuj cu qvjuh jxu jewq fqhjo
14 btti bt puitg iwt idvp epgin
3. The language of the plaintext is known
15 assh as othsf hvs hcu o dofhm
and easily recognizable
16 zrrg zr nsgre gur gbtn cnegl
17 yqqf yq mrfqd ftq fasm bmdfk
18 xppe xp lqepc esp ezrl alcej
19 wood wo kpdob dro dyqk zkbdi
20 vnnc vn jocna cqn cxpj yjach
21 ummb um inbmz bpm bwoi xizbg
22 tlla tl hmaly aol avnh whyaf
23 skkz sk glzkx znk zumg vgxze
24 rjjy rj fkyjw ymj ytlf ufwyd
18
25 qiix qi ejxiv xli xske tevxc
Figure
(This 3.3can
chart Brute-Force Cryptanalysis
be found on of Caesar
page 71 in the Cipher
textbook)
TASK
• Break Cipher
GCUA VQ DTGCM
19
Sample Compressed Text
20
Monoalphabetic Cipher
• 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
If the “cipher” line can be any permutation of the 26 alphabetic characters, then
there are 26! or greater than 4 x 1026 possible keys
21
Cryptanalysis of Monoalphabetic Cipher
Step #01: Determine relative frequency of the letters can be determined and compared to
a standard frequency distribution for English
• In any case, the relative frequencies of the letters in the ciphertext (in percentages) are
as follows:
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
Step #02 After Comparing this breakdown, it seems likely P and Z = e and t, but it is not
certain which is which.
S, U, O, M, and H are all of relatively high frequency and probably correspond to plain
letters from the set {a, h, i, n, o, r, s}.
The letters with the lowest frequencies (namely, A, B, G, Y, I, J) are likely included in the
set {b, j, k, q, v, x, z}.
23
Cryptanalysis of Monoalphabetic Cipher
• Easy to break because they reflect the frequency data of the original
alphabet
• Digram
Two-letter combination
Most common is th
• Trigram
Three-letter combination
Most frequent is the
24
Cryptanalysis of Monoalphabetic Cipher
• Ciphertext: UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
• The most common digram is ZW, which appears three times. So we make the
correspondence of Z with t and W with h. Then, by our earlier hypothesis, we can
equate P with e.
• Now notice that the sequence ZWP appears in the ciphertext, and we can translate
that sequence as “the.” This is the most frequent trigram (three-letter combination)
• 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.
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ’
t a e e te a that e e a a
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
e t ta t ha e ee a e th t a
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
e e e tat e the t
25
Playfair Cipher
• Best-known multiple-letter encryption cipher
Encrypts multiple letters instead of single letter at a time
• Treats digrams in the plaintext as single units and translates
these units into ciphertext digrams
• Based on the use of a 5 x 5 matrix of letters constructed using a
keyword
• Invented by British scientist Sir Charles Wheatstone in 1854
• Developed for telegraph (communication/cable/wire) secrecy
• Used as the standard field system by the British Army in World
War I and the U.S. Army and other Allied forces during World
War II.
26
Playfair Cipher
Example:
Plaintext: BALLOON
Key: MONARCHY
1. Construct the matrix by filling in the letters of the keyword and remaining
letters in alphabetical order. The letters I and J count as one letter.
BA LX LO ON
27
Playfair Cipher
4. Look into the matrix for the pair encryption,
5. Two PT letter fall in same column are replaced with the letter beneath
them
BA LX LO ON
I/J B
6. The PT letter lies in different row and column are replaced by letter lies
at the intersection of them (same row and column)
BA LX LO ON
I/J B SU PM
7. Two PT letter fall in same row are replaced with the letter on right side
BA LX LO ON
I/J B SU PM NA
28
Playfair Cipher
Activity #03
29
30