1 intro to crypto and mod supplementary notes prepared by raymond wong presented by raymond wong

31
1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

Upload: tariq-wimbrow

Post on 14-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

1

Intro to Crypto and Mod

Supplementary Notes

Prepared by Raymond WongPresented by Raymond Wong

Page 2: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

2

e.g.1 (Page 4)

E.g., m = 21 n = 9 21 can be expressed as 9 x 2 + 3 (i.e., nq + r)

q = 2r = 3

0 r < n

r is defined to be 21 mod 9

21 mod 9 is equal to 3

Page 3: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

3

e.g.2 (Page 9) Illustration of

[(-m) mod n] = n – [m mod n] E.g., m = 4

n = 5

E.g., m = 9 n = 5

-4 mod 5

-9 mod 5

4 mod 5 = 4

9 mod 5 = 4

= 5 – (4 mod 5)

= 5 – (9 mod 5)

= 5 – 4 = 1

= 5 – 4 = 1

Page 4: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

4

e.g.3 (Page 10)

2 x 8 mod 9 = 16 mod 9 = 7

(2 mod 9) (8 mod 9) = 2 x 8 = 16

(2 + 8) mod 9 = 1

(2 mod 9) + (8 mod 9) = 2 + 8 = 10

Conclusion: 2 x 8 mod 9 (2 mod 9) (8 mod 9)

Conclusion: (2 + 8) mod 9 (2 mod 9) + (8 mod 9)

Page 5: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

5

e.g.4 (Page 11)

Illustration of Lemma 2.2 E.g.,

i = 1 n = 5

1 mod 5 = 1

(1 + 5) mod 5 = 6 mod 5 = 1

(1 + 2x5) mod 5 = 11 mod 5 = 1

(1 + 3x5) mod 5 = 16 mod 5 = 1

(1 + k.5) mod 5 = 1

(1 + (-1)x5) mod 5 = -4 mod 5 = 1

(1 + (-2)x5) mod 5 = -9 mod 5 = 1

(1 + (-3)x5) mod 5 = -14 mod 5 = 1

Page 6: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

6

e.g.5 (Page 11)

Illustration of Lemma 2.2 E.g.,

i = 11 n = 5

11 mod 5 = 1

(11 + 5) mod 5 = 16 mod 5 = 1

(11 + 2x5) mod 5 = 21 mod 5 = 1

(11 + 3x5) mod 5 = 26 mod 5 = 1

(11 + k.5) mod 5 = 1

(11 + (-1)x5) mod 5 = 6 mod 5 = 1

(11 + (-2)x5) mod 5 = 1 mod 5 = 1

(11 + (-3)x5) mod 5 = -4 mod 5 = 1

Page 7: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

7

e.g.6 (Page 11)

Prove that 11 mod 5 = (11 + k.5) mod 5for all integers k

Let r = 11 mod 5

By Euclid’s Division Theorem, we can write 11 = 5q + rwhere q and r are two unique integers and 0 r < 5

Consider 11 + k.5= (5q + r) + k.5

= 5q + r + k.5

= 5q + k.5 + r

= 5(q + k) + r

By the definition of Euclid’s division theorem, (11 + k.5) mod 5 = r

Page 8: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

8

e.g.7 (Page 12)

Illustration of Lemma 2.3 E.g.,

(2 + 8) mod 9 = (2 + (8 mod 9)) mod 9

= ((2 mod 9) + 8) mod 9

= ((2 mod 9) + (8 mod 9)) mod 9

(2.8) mod 9 = (2 . (8 mod 9)) mod 9

= ((2 mod 9) . 8) mod 9

= ((2 mod 9) . (8 mod 9)) mod 9

Page 9: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

9

e.g.8 (Page 12)

2 x 8 mod 9 = 16 mod 9 = 7

((2 mod 9) (8 mod 9)) mod 9 = 2 x 8 mod 9 = 16 mod 9 = 7

(2 + 8) mod 9 = 1

((2 mod 9) + (8 mod 9)) mod 9 = (2 + 8) mod 9 = 10 mod 9 = 1

Conclusion: 2 x 8 mod 9 = ((2 mod 9) (8 mod 9)) mod 9

Conclusion: (2 + 8) mod 9 = ((2 mod 9) + (8 mod 9)) mod 9

Page 10: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

10

e.g.8

(2 + 8) mod 9 = 1

((2 mod 9) + (8 mod 9)) mod 9 = (2 + 8) mod 9 = 10 mod 9 = 1

Conclusion: (2 + 8) mod 9 = ((2 mod 9) + (8 mod 9)) mod 9

Claim: (20 + 17) mod 9 = ((20 mod 9) + (17 mod 9)) mod 9

Page 11: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

11

e.g.8Claim: (20 + 17) mod 9 = ((20 mod 9) + (17 mod 9)) mod 9

Why is it correct?By Euclid’s Division Theorem, we can write 20 as follows.

20 = 9q1 + r1 where q1 and r1 are some unique integers.= 9q1 + (20 mod 9)

By Euclid’s Division Theorem, we can write 17 as follows. 17 = 9q2 + r2 where q2 and r2 are some unique integers.

= 9q2 + (17 mod 9)

Consider (20 + 17) mod 9

= {[9q1 + (20 mod 9)] + [9q2 + (17 mod 9)]} mod 9= {9q1 + (20 mod 9) + 9q2 + (17 mod 9)} mod 9= [ (20 mod 9) + (17 mod 9) + 9q1 + 9q2] mod 9

= [ (20 mod 9) + (17 mod 9) + 9(q1 + q2)] mod 9

= [ (20 mod 9) + (17 mod 9)] mod 9

Lemma 2.2 (Y + 9k) mod 9 = Y mod 9

(by Lemma 2.2)

Page 12: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

12

e.g.9 (Page 14)

E.g. 0 +5 2 = 2

E.g., 1.52 = 2

(0 + 2) mod 5 = 2 mod 5 = 2

(1.2) mod 5 = 2 mod 5 = 2

Page 13: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

13

e.g.10 (Page 15) Illustration of Theorem 2.4

Commutative law

Associative law

Distributive law

2 x9 8 = 8 x9 2

2 +9 8 = 8 +9 2

2 x9 (8 x9 1) = (2 x9 8) x9 1

2 +9 (8 +9 1) = (2 +9 8) +9 1

2 x9 (8 +9 1) = (2 x9 8) +9 (2 x9 1)

Page 14: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

14

e.g.11 (Page 24)

I love UST. kfjEfklje$3 I love UST.

encryptiondecryption

password password

Page 15: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

15

e.g.11

I love UST. kfjEfklje$3 I love UST.

encryptiondecryption

keroro keroro

Page 16: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

16

e.g.11

I love UST. kfjEfklje$3 I love UST.

encryptiondecryption

keroro keroro

sender receiverkfjEfklje$3

attacker

Undecipherable(cannot be decrypted easily)

keroro keroro

Page 17: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

17

e.g.11

I love UST. I love UST.

encryption

0

Page 18: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

18

I love UST. J mpwf VTU.

encryption

1

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

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 a

Page 19: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

19

I love UST. K nqxg WUV.

encryption

2

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

c 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

Page 20: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

20

I love UST. L oryh XVW.

encryption

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

Page 21: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

21

e.g.12 (Page 32)

7 11

encryption

a = 5n = 12

Encrypted value = 5 .

12 7= 5 . 7 mod 12= 35 mod 12= 11

Encryption function= 5 .

12 x Multiplication modn

Is there any division modn ?

Page 22: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

22

e.g.13 (Page 32)

Examples that an inverse function exists S T

T S

f

f-1

123

4

a

bc

d

a

bc

d

123

4

A function!

Page 23: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

23

e.g.14 (Page 32)

Examples that an inverse function does not existS T

T S

f

No such f-1

123

4

a

bc

a

bc

123

4

Not a function!

Page 24: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

24

e.g.15 (Page 34)S

f4, 12

012

3

4

5

6

7

8

9

10

11

T

012

3

4

5

6

7

8

9

10

11

The inverse of f4, 12 does not exist

sender receiver3

Encrypted

0

sender receiver6

Encrypted

0

The receiver cannot determine the original number.

Case (a): a = 4, n = 12

f4, 12 (x) = 4.x mod 12

Page 25: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

25

e.g.16 (Page 35)S

f3, 12

012

3

4

5

6

7

8

9

10

11

T

012

3

4

5

6

7

8

9

10

11

The inverse of f3, 12 does not exist

sender receiver2

Encrypted

6

sender receiver6

Encrypted

6

The receiver cannot determine the original number.

Case (b): a = 3, n = 12

f3, 12 (x) = 3.x mod 12

Page 26: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

26

e.g.17 (Page 36)S

f5, 12

012

3

4

5

6

7

8

9

10

11

T

012

3

4

5

6

7

8

9

10

11

The inverse of f5, 12 exists

sender receiver7

Encrypted

11

sender receiver1

Encrypted

5

The receiver can uniquely determine the original number.

Case (c): a = 5, n = 12

f5, 12 (x) = 5.x mod 12

Page 27: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

27

e.g.18 (Page 41)

Private-key cryptosystems

sender receiver1

Encrypted

5

private-key (e.g., 2) private-key (e.g., 2)

Encrypt this message with this private-key

1

Decrypt this message with the same private-key

Encrypted

5

Encrypted

5

It should be kept privately at the sender’s side.

It should be kept privately at the receiver’s side.

Page 28: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

28

e.g.19 (Page 41)

Public-key cryptosystems

sender receiver1

Encrypted

5

public key (e.g., 2) secret-key (e.g., 4)

Encrypt this message with a public-key

1

Decrypt this message with a secret-key

Encrypted

5

Encrypted

5

It can be kept publicly.

It should be kept privately at the receiver’s side.

It has some relationships with the public key.

Page 29: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

29

e.g.19 (Page 41)

Public-key cryptosystems

sender receiver1

Encrypted

5

public key (e.g., 2) secret-key (e.g., 4)

Encrypt this message with a public-key

1

Decrypt this message with a secret-key

Encrypted

5

Encrypted

5

It should be kept privately at the receiver’s side.

Raymond

Public Key Directory

Raymond 2

Peter

Peter 7

This directory is accessible to the public.

It can be kept publicly.

Page 30: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

30

e.g.20 (Page 44)

An ideal key pair (public key and secret key) Given a public key,

it is difficult for the adversary to deduce the secret key

Page 31: 1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong

31

e.g.20

Public-key cryptosystems

sender receiver167

Encrypted

338

public key secret-key

rev (1000 – M) = rev (1000 – 167) = rev (833) = 338

167

1000 – rev(C) = 1000 – rev (338) = 1000 – 833 = 167

Encrypted

338

Encrypted

338

It is not secure. Why?