0% found this document useful (0 votes)
82 views30 pages

Lecture#02 Part 1 - Classical Encryption Techniques

The document discusses classical encryption techniques, specifically covering definitions, the symmetric cipher model, cryptographic systems, cryptanalysis and brute-force attacks. It also covers the Caesar cipher technique in detail as an example of a simple substitution cipher.

Uploaded by

fasih
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)
82 views30 pages

Lecture#02 Part 1 - Classical Encryption Techniques

The document discusses classical encryption techniques, specifically covering definitions, the symmetric cipher model, cryptographic systems, cryptanalysis and brute-force attacks. It also covers the Caesar cipher technique in detail as an example of a simple substitution cipher.

Uploaded by

fasih
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/ 30

CLO 1

Lecture#02
Classical Encryption Techniques
Course: Cryptography & Network Security (CE-408)
Course Teacher: Ms. Rukaiya

Contact Info:

Room No: BS-02, CED

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

• There are two requirements for secure use of


conventional encryption:

1. A strong encryption algorithm

2. Sender and receiver must have obtained copies of the


secret key in a secure fashion and must keep the key
secure

4
^
X
Cryptanalyst
^
K

Message X Encryption Decryption X


Destination
Source Algorithm Y = E(K, X) Algorithm

Secure Channel
Key
Source

Figure: Model of Symmetric Cryptosystem


Figure 3.2 Model of Symmetric Cryptosystem

5
Cryptographic Systems
• Characterized along three independent dimensions

The type of operations


The number of keys The way in which the
used for transforming
used plaintext is processed
plaintext to ciphertext

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

• Attack exploits the characteristics of the algorithm to attempt to


deduce a specific plaintext or to deduce the key being used

Brute-force attack
• Attacker tries every possible key on a piece of ciphertext until
an intelligible translation into plaintext is obtained

• On average, half of all possible keys must be tried to achieve


success

7
Types of Attacks on Encrypted Messages

e.g., Headers/preambles, copyright information

e.g., Hashing can prevent it

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

Involves trying every possible key until an


intelligible translation of the ciphertext into
plaintext is obtained

On average, half of all possible keys must be


tried to achieve success

To supplement the brute-force approach, some


degree of knowledge about the expected plaintext
is needed, and some means of automatically
distinguishing plaintext from garble is also
needed

10
Key Strength

Key Size (bits) No. of alternative Time required at


Keys 𝟏𝟎𝟔 Decryption
32 232 = 4.3 × 109 2.15 msec
56 256 = 7.2 × 1016 10 hrs
128 2128 = 3.4 × 1038 5.4 × 1018 years
168 2168 = 3.7 × 1050 5.9 × 1030 years

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

• Properties that make an encryption algorithm strong are:


 Appropriate choice of cryptographic algorithm
 Use of sufficiently long key lengths
 Appropriate choice of protocols
 A well-engineered implementation
 Absence of deliberately introduced hidden flaws

12
Classical Cryptographic
Techniques

13
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

14
Caesar Cipher

• Simplest and earliest known use of a substitution cipher


• Used by Julius Caesar about 2000 years ago
• Involves replacing each letter of the alphabet with the letter standing
three places further down the alphabet
• Alphabet is wrapped around so that the letter following Z is A
General Algorithm
Encryption: A shift may be of any amount, so that the general
Caesar algorithm is:
𝑪 = 𝑬 𝒌, 𝒑 = 𝒑 + 𝒌 𝒎𝒐𝒅 𝟐𝟔
Decryption: Where k takes on a value in the range 1 to 25; the
decryption algorithm is simply:
P= 𝑫 𝒌, 𝑪 = 𝑪 − 𝒌 𝒎𝒐𝒅 𝟐𝟔
15
Caesar Cipher
• Mathematically give each letter a number
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

• Can define transformation as (k=3):


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
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C

• Algorithm can be expressed as:


c = E(3, p) = (p + 3) mod (26)

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

Figure: Sample of 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

 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.

 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

 Approach is referred to as a monoalphabetic substitution cipher because a


single cipher alphabet is used per message

21
Cryptanalysis of Monoalphabetic Cipher

Figure: Relative Frequency of Letters in English Text


22
Cryptanalysis of Monoalphabetic Cipher
Example:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ

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

• Countermeasure is to provide multiple substitutes (homophones) for a


single letter

• 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.

2. Break the plaintext into pairs.


3. Repeating plaintext letters that are in same pair are separated with filler
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

Plaintext = COME TO OFFICE


KEY = SECRET

29
30

You might also like