Docsity

Cryptography: Cryptanalysis and Techniques for Breaking Codes - Prof. Lih Deng, Study notes of Computer Science

Toggle sidebar
bg1
1
Cryptanalysis
Assumption: (Kerckhoffs’ principle) the
cryptosystem used is known to the
opponent.
designer should not assume what system
used can remain secret.
attack models: kind of information
available 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) where
xÆyis known.
3. chosen plaintext attack: temporary access
to ek(x) [encryption machine]
4. chosen ciphertext attack: temporary access
to dk(y) [decryption machine]
Cryptanalysis using statistical
properties
statistical analysis is useful for most of
mono-alphabetic cryptosystems of
English text.
basic idea:
relative frequency of 26 letters are quite
different. (e.g. “E” vs. “Z”).
there are popular digrams (e.g. “TH”) and
trigrams (e.g. “ING”).
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Cryptography: Cryptanalysis and Techniques for Breaking Codes - Prof. Lih Deng and more Study notes Computer Science in PDF only on Docsity!

Cryptanalysis „ Assumption: (Kerckhoffs’ principle) thecryptosystem used is known to the

opponent. „ „ designer should not assume what systemused can remain secret.attack models: kind of information

available to the adversary.

Attack models „1. x=plaintext, y=ciphertext.ciphertext only attack: only y is known.(weakest type of attack models)

2.3.4. known plaintext attack: some (x,y) wherexchosen plaintext attack: temporary accessto echosen ciphertext attack: temporary accessÆ ky is known. (x) [encryption machine]

to d k (y) [decryption machine]

Cryptanalysis using statisticalproperties „ statistical analysis is useful for most of

„ mono-alphabetic cryptosystems ofEnglish text.basic idea: „ relative frequency of 26 letters are quite

„ different. (e.g. “E” vs. “Z”).there are popular digrams (e.g. “TH”) andtrigrams (e.g. “ING”).

Table 1.1. Letter Frequency

MLKJIH 0.0240.0400.0080.0020.0700.061 WZYXVU 0.0010.0200.0010.0230.0100.

GFEDCB 0.0200.0220.1270.0430.0280.015 TSRQPO 0.0910.0630.0600.0010.0190.

A 0.082 N 0.

UCLDRH 0.0280.0280.0400.0430.0600.061 ZXQJKV 0.0010.0010.0010.0020.0080.

SNIOAT 0.0630.0670.0700.0750.0820.091 BPYGFW 0.0150.0190.0200.0200.0220.

E 0.127 M 0.

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

Cryptanalysis: affine cipher „ „ Encryption eSome known ciphertext as in e.g. 1.10: „ “a” and “b” are unknown. k (x)= a x + b mod 26.

„ Matching most popular letters between Table1.1 and Table 1.2 can be useful to solve “a”and “b”. (two unknowns and two equations)FMXVEDKAPHFERBNDKRXRSRE…^ „^ Frequency table in Table 1.2 (page 28).

Cryptanalysis: Vigenere cipher „ keyword of length m: „ m=key word length. k = (k 1 , k 2 , …, k m )

„ „ y e“position” in each block of size m. „= (yk (xn=(large) ciphertext length. assume m|n.i ) = x 1 , y 2 i , …, y + k i (mod 26), i=1,..,m is the n) is observed

„ Cryptanalysis: need to find m and k.

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

„ „ „ Q: how to find m and keywordA: Kasiski test.NOTE: CHR appeared five times atposition 1, 166, 236, 276, and 286. k?

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

I „ „c ( x Let f x = (x): index of coincidence 0 , f 1 , x 1 , … , f 2 , …, x 25 n )be the frequency

„ counts of letters ‘A’, ‘B’, …, ‘Z’ inQ: Randomly choosing two letters from x identical letter? [denoted as I, what is the probability of beingc ( x^ x )].

„ A: I c ( x ) = Σ [fi (fi -1)]/[n(n-1)]. (why?)

Using I „ „ y Divide „= (y y 1 = y 1 , y y 1 , y cinto m (guess) sub-strings as 2 (, …, ym+1 x , y) to find m2m+1n ) be the ciphertext. , …

„ Compute I^ „^ „^ „ „^ y … y for correct m, the values of I^2 m^ = y^ = y^2 m^ , y^ , ym+2c2m(y^ , y^ , y i ), i=1, 2, .., m.2m+23m^ , …^ , … c ( y i ) ≈ 0.065?

„ for incorrect m, the values of I c ( y i ) ≈ 0.038?

Block length m determination „ Recall I „ If „ x p i is a regular English text, I=the relative frequency in Table 1.1. (i=0,1,…,25) c( x ) = Σ [f i (f i -1)]/[n(n-1)] c ( x ) ≈ Σ pi 2 =0.065.

„ For m indices^ „ „^ Ifif m is correct,text, and the values of I^ „^ x Note: I^ is a random text, Ic^ ( x ) remains unchanged with permutation. I c y (yi is a sub-string of regular English i), i=1, 2, .., m.^ c^ ( c x ( y )^ i )≈ Σ ≈ 0.065(1/26)^2 = 0.038.

„ if m is incorrect,and values of I c ( yy ii ) is a sub-string of random test,≈ 0.

Example 1.12. Find m. „ e.g. 1.12 (page 34) ciphertext: „ CHREEVOAHMAERATBIAXXWTNXBE…

„ „ „ „ if m=1, only one string, Iif m=2, Iif m=3, Iif m=4, I ccc( ( ( yyy i 1 i ) = 0.042, 0.039, 0.045, 0.040 ) = 0.043, 0.050, 0.047 ) = 0.046, Ic ( c ( yy 2 ) = 0.045 ) = 0.

„ if m=5, I0.0061, 0.072. (c ( y i ) = 0.063, 0.068, 0.069,≈0.065)

Hill cipher „ „ P=C=(ZK=(Z 26 ) mxm 26 ) m , key K is a mxm matrix.

„ „ „ „ plaintext:ciphertext :edk k ( ( xy ) =) = x K y K x = (x y (mod 26),-1= (y (mod 26). 1 , x 1 , y 2 , …, x 2 , …, ym )m )

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

„ However, it is quite simple to breakunder known plaintext attack.^ „^ statistical frequency analysis is not useful.why not?

„ collect at least m pairs of (a mxm matrix equation. (how?) x i, y i) and solve

Break Hill cipher „ For i=1,2, …, m „ „ i-th plaintext:i-th ciphertext : x i= (x y i1, xi2, …, xim)

„ „ Q: how findA: stack^ „^ y i^ =^ x i^ Kx^ i(mod 26), together as matrix K (and thereforei= (y^ K^^ i1unknown., y^ i2, …, y KX^ im-1, stack)^ )? y i

„ together as matrix Y = X K by Y X -1^ =^ Y. K^ We can solvemod 26.

Example 1.13 „ 1.Suppose fridaywith m=2. Find the key matrix. fr -> PQ: [5, 17] = [15,16] Æ PQCFKU using Hill cipher K

„ 2.^ 3.^ From first two equations, we can solve a2x2 matrix equation: (show!!)id -> CF: [8, 3] = [2,5]ay -> KU: [0, 24] = [10, 20] Y = X K^ K^ K

„ Q: what if we don’t know m?

LFSR key stream cipher „ z „ i+m c 0 = c =1, other c 0 z i + c 1 iz is 0 or 1. i+1 + … + cm-1 z i+m mod 2

„ We can break the cryptosystem with apartial sequence (with length 2m) of z^ „^ Max period = 2^ „^ How to choose “keys”m-1.^ ci^? i.

„ Q: How?

Cryptanalysis: LFSR streamcipher „ z m+1 = c 0 z 1 + c 1 z 2 + … + cm-1 z m

„ „ „ „ zz…... z m+2 m+3 2m = c= c= c 000 zzz m 2 3 + c+ c+ c 111 zzz m+1 3 4 + … + c+ … + c + … + cm-1m-1m-1 zz m+1 m+2 z 2m-

„ re-written as (column) „ m equations, m unkowns. z = M c , c = M -1^ z.

Chapter Review: Modulus andMatrix operations „ Modulus operations

„ „ Matrix MultiplicationMatrix Inverse^ „ „^ (-a) mod m, a2x2 matrix -1^ mod m.

„ „ mxm matrixMatrix Inverse mod m.

Chapter Review: Euler totientfunction „ φ(n): number of integers between 1 and n φ(n)

„ „ that are relative prime to n.Computation ofE.g.1.2. φφ(p(P Q)=e)= p e-1φ(P) (p-1) φ (Q), if gcd (P,Q)=1.φ(n):

The Use of Encryption „ „ DES and AES (Ch 3)Cryptographic Hash Functions (Ch 4)

„ „ „ Digital Signatures (Ch 7)Certificates (Ch 9)Key Exchange/Distribution (Ch 10)