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

## Presentation on theme: "1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong."— Presentation transcript:

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 = 2 r = 3 0  r < n r is defined to be 21 mod 9 21 mod 9 is equal to 3

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

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)

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

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

7 e.g.6 (Page 11) Prove that 11 mod 5 = (11 + k. 5) mod 5 for all integers k Let r = 11 mod 5 By Euclid’s Division Theorem, we can write 11 = 5q + r where 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

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

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

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

11 e.g.8 Claim: (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 = 9q 1 + r 1 where q 1 and r 1 are some unique integers. = 9q 1 + (20 mod 9) By Euclid’s Division Theorem, we can write 17 as follows. 17 = 9q 2 + r 2 where q 2 and r 2 are some unique integers. = 9q 2 + (17 mod 9) Consider (20 + 17) mod 9 = {[9q 1 + (20 mod 9)] + [9q 2 + (17 mod 9)]} mod 9 = {9q 1 + (20 mod 9) + 9q 2 + (17 mod 9)} mod 9 = [ (20 mod 9) + (17 mod 9) + 9q 1 + 9q 2 ] mod 9 = [ (20 mod 9) + (17 mod 9) + 9(q 1 + q 2 )] mod 9 = [ (20 mod 9) + (17 mod 9)] mod 9 Lemma 2.2 (Y + 9k) mod 9 = Y mod 9 (by Lemma 2.2)

12 e.g.9 (Page 14) E.g. 0 + 5 2 = 2 E.g., 1. 5 2 = 2 (0 + 2) mod 5 = 2 mod 5 = 2 (1. 2) mod 5 = 2 mod 5 = 2

13 e.g.10 (Page 15) Illustration of Theorem 2.4 Commutative law Associative law Distributive law 2 x 9 8 = 8 x 9 2 2 + 9 8 = 8 + 9 2 2 x 9 (8 x 9 1) = (2 x 9 8) x 9 1 2 + 9 (8 + 9 1) = (2 + 9 8) + 9 1 2 x 9 (8 + 9 1) = (2 x 9 8) + 9 (2 x 9 1)

14 e.g.11 (Page 24) I love UST. kfjEfklje\$3I love UST. encryption decryption password

15 e.g.11 I love UST. kfjEfklje\$3I love UST. encryption decryption keroro

16 e.g.11 I love UST. kfjEfklje\$3I love UST. encryption decryption keroro senderreceiver kfjEfklje\$3 attacker Undecipherable (cannot be decrypted easily) keroro

17 e.g.11 I love UST. encryption 0

18 I love UST. J mpwf VTU. encryption 1 abcdefghi jklmnopqr stuvwxyz b cdefghij k lmnopqrs t u vwxyza

19 I love UST. K nqxg WUV. encryption 2 abcdefghi jklmnopqr stuvwxyz c defghijk l mnopqrst u v wxyzab

20 I love UST. L oryh XVW. encryption 3 abcdefghi jklmnopqr stuvwxyz d efghijkl m nopqrstu v w xyzabc

21 e.g.12 (Page 32) 7 11 encryption a = 5 n = 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 ?

22 e.g.13 (Page 32) Examples that an inverse function exists S T T S f f -1 1 2 3 4 a b c d a b c d 1 2 3 4 A function!

23 e.g.14 (Page 32) Examples that an inverse function does not exist S T T S f No such f -1 1 2 3 4 a b c a b c 1 2 3 4 Not a function!

24 e.g.15 (Page 34) S f 4, 12 0 1 2 3 4 5 6 7 8 9 10 11 T 0 1 2 3 4 5 6 7 8 9 10 11 The inverse of f 4, 12 does not exist sender receiver 3 Encrypted 0 sender receiver 6 Encrypted 0 The receiver cannot determine the original number. Case (a): a = 4, n = 12 f 4, 12 (x) = 4. x mod 12

25 e.g.16 (Page 35) S f 3, 12 0 1 2 3 4 5 6 7 8 9 10 11 T 0 1 2 3 4 5 6 7 8 9 10 11 The inverse of f 3, 12 does not exist sender receiver 2 Encrypted 6 sender receiver 6 Encrypted 6 The receiver cannot determine the original number. Case (b): a = 3, n = 12 f 3, 12 (x) = 3. x mod 12

26 e.g.17 (Page 36) S f 5, 12 0 1 2 3 4 5 6 7 8 9 10 11 T 0 1 2 3 4 5 6 7 8 9 10 11 The inverse of f 5, 12 exists sender receiver 7 Encrypted 11 sender receiver 1 Encrypted 5 The receiver can uniquely determine the original number. Case (c): a = 5, n = 12 f 5, 12 (x) = 5. x mod 12

27 e.g.18 (Page 41) Private-key cryptosystems senderreceiver 1 Encrypted 5 private-key (e.g., 2) Encrypt this message with this private-key 1 Decrypt this message with the same private-key Encrypted 5 5 It should be kept privately at the sender’s side. It should be kept privately at the receiver’s side.

28 e.g.19 (Page 41) Public-key cryptosystems senderreceiver 1 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 5 It can be kept publicly. It should be kept privately at the receiver’s side. It has some relationships with the public key.

29 e.g.19 (Page 41) Public-key cryptosystems senderreceiver 1 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 5 It should be kept privately at the receiver’s side. Raymond Public Key Directory Raymond2 Peter 7 This directory is accessible to the public. It can be kept publicly.

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

31 e.g.20 Public-key cryptosystems senderreceiver 167 Encrypted 338 public keysecret-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?

Download ppt "1 Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong."

Similar presentations