Docsity

Cryptanalysis - Lecture Slides - Cryptography and Data Security | COMP 7120, Study notes of Computer Science

Partial preview of the text

Download Cryptanalysis - Lecture Slides - Cryptography and Data Security | COMP 7120 and more Study notes Computer Science in PDF only on Docsity!

Cryptanalysis^ „^ Assumption: (Kerckhoffs’ principle) thecryptosystem used is known to theopponent.

„^ designer should not assume what systemused can remain secret. „^ attack models: kind of informationavailable to the adversary.

Attack models^ „^

x=plaintext, y=ciphertext.

1.^

ciphertext only attack: only y is known.(weakest type of attack models)

2.^

known plaintext attack: some (x,y) wherexÆ

y is known.

3.^

chosen plaintext attack: temporary accessto e

(x)k^

[encryption machine]

4.^

chosen ciphertext attack: temporary accessto d

(y) [decryption machine]k

Table 1.1. Letter Frequency

Z

M

Y

L

X

K

W

J

V

I

U

H

T

G

S

F

R

E

Q

D

P

C

O

B

N

A

Z

U

X

C

Q

L

J

D

K

R

V

H

B

S

P

N

Y

I

G

O

F

A

W

T

M

E

Common Digram and Trigram^ „^ Common 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

„^ Common Trigram: „^ THE, ING, AND,HER, ERE, ENT,THA, NTH, WAS,ETH, FOR, DTH

Table 1.1 vs. Table 1.

Z

U

X

C

Q

L

J

D

K

R

V

H

B

S

P

N

Y

I

G

O

F

A

W

T

M

E

Z

U

W

P

T

M

Q

L

J

A

I

S

G

V

C

F

Y

K

O

H

N

E

B

D

X

R

Cryptanalysis: affine cipher^ „^ Encryption e

(x)= a x + b mod 26.k

„^ “a” and “b” are unknown.

„^ Matching Table 1.1 and Table 1.2 canreduce the number of ways to solve “a”and “b”.

(read e.g. 1.10, page 28-29).

„^ NOTE: since the key space is small(how many ?), we can easily solve byan exhaustive search program.

Cryptanalysis: Vigenere cipher^ „^ keyword of length m:

k = (k

, k 1

, …, k 2

)m

„^ m=key word length.

„^ y

= (y

, y 1

, …, y 2

) is observedn

„^ n=(large) ciphertext length. assume m|n.

„^ e

(xk

) = xi

+ ki

(mod 26), i=1,..,m is thei

“position” in each block of size m. „ Cryptanalysis: need to find m and

k.

Cryptanalysis: Vigenere cipher^ „^ e.g. 1.12 (page 34) ciphertext:

„^ CHREEVOAHMAERATBIAXXWTNXBE…

„^ Q: how to find m and keyword

k^

„^ A: Kasiski test. „^ NOTE: CHR appeared five times atposition 1, 166, 236, 276, and 286.

„^ “distances” are multiple of 5. Hence m=5. „^ Other systematic method?

Using I

( x c

) to find m

„^ y

= (y

, y 1

, …, y 2

) be the ciphertext.n

„^ Divide

y^

into m (guess) sub-strings as

„^ y

= y 1

, y^1

m+

, y 2m+

„^ y

= y 2

, y^2

m+

, y 2m+

„^ … „^ y

= ym

, ym

, y2m

, …3m

„^ Compute I

(yc

), i=1, 2, .., m.i^

„^ for correct m, the values of I

( y c^ i

)^ ≈

„^ for incorrect m, the values of I

( y c i

)^ ≈

Block length m determination^ „^ Recall I

( x c

Σ^

[f^ (fi^

-1)]/[n(n-1)]i^

„^ If

x^ is a regular English text, I

( x )c

2 pi

„^ pi^

=the relative frequency in Table 1.1. (i=0,1,…,25)

„^ Note: I

( x ) remains unchanged with permutation.c

„^ If

x^ is a random text, I

( x )c

„^ For m indices

Ic

(y^ ), i=1, 2, .., m.i

„^ if m is correct,

y i^

is a sub-string of regular English

text, and the values of I

( y c i

)^ ≈

„^ if m is incorrect,

y i^

is a sub-string of random test,

and values of I

( y c i

)^ ≈

Find key

k

„^ Divide

y^

into m sub-strings as

„^ y

= y 1

, y^1

m+

, y 2m+

„^ y

= y 2

, y^2

m+

, y 2m+

„^ … „^ y

= ym

, ym

, y2m

, …3m

„^ Note: Each letter in

y i^

has been shifted by the

same amount g=k

. We search for g such thati

Mg^

=^ Σ

pj^

Qj+g

2 pj

≈0.065. [why ?]

„^ Q

is the relative letter frequency inj+g

y i.

Example 1.12. Find key

k

„^ e.g. 1.12 (page 34) ciphertext:

„^ CHREEVOAHMAERATBIAXXWTNXBE…

„^ m=5. Divide the ciphertext into 5substrings.

y^1

,^ y

y^5

„^ For each g=0,1,2,…,25 compute M

( y g^

)i

as shown in Table 1.4 (page 35) „ The correct key index g are boxed.^ „^ k

=(9,0,13,4,19)=JANET. (show!)

Hill cipher^ „^ P=C=(Z

m

„^ K=(Z

mxm

,^

key

K^

is a mxm matrix.

„^ plaintext:

x = (x

, x 1

, …, x 2

)m

„^ ciphertext :

y = (y

, y 1

, …, y 2

)m

„^ e

( x k

x K

(mod 26),

„^ d

( y k

)^

=^

y K

-1^ (mod 26).

Cryptanalysis: Hill cipher^ „^ Can be hard to break with ciphertextonly.

„^ statistical frequency analysis is not useful.why not?

„^ However, it is quite simple to breakunder known plaintext attack.

„^ collect at least m pairs of (

x ,^ i

y ) and solvei^

a mxm matrix equation. (how?)