Intro to Crypto and Mod Supplementary Notes Prepared


![e. g. 2 (Page 9) n n Illustration of [(-m) mod n] = n e. g. 2 (Page 9) n n Illustration of [(-m) mod n] = n](https://slidetodoc.com/presentation_image_h/000846a1f31b99c0bb13e1b7c8c58666/image-3.jpg)




























- Slides: 31
Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong 1
e. g. 1 (Page 4) n E. g. , m = 21 n=9 21 can be expressed as 9 x 2+3 (i. e. , nq + r) r is defined to be 21 mod 9 q=2 r=3 21 mod 9 is equal to 3 0 r<n 2
e. g. 2 (Page 9) n n Illustration of [(-m) mod n] = n – [m mod n] E. g. , m = 4 4 mod 5 = 4 n=5 -4 mod 5 = 5 – (4 mod 5) = 5 – 4 = 1 E. g. , m = 9 n=5 9 mod 5 = 4 -9 mod 5 = 5 – (9 mod 5) = 5 – 4 = 1 3
e. g. 3 (Page 10) 2 x 8 mod 9 = 16 mod 9 = 7 (2 mod 9) (8 mod 9) = 2 x 8 = 16 Conclusion: 2 x 8 mod 9 (2 mod 9) (8 mod 9) (2 + 8) mod 9 = 1 (2 mod 9) + (8 mod 9) = 2 + 8 = 10 Conclusion: (2 + 8) mod 9 (2 mod 9) + (8 mod 9) 4
e. g. 4 (Page 11) n n Illustration of Lemma 2. 2 E. g. , i=1 n=5 1 mod 5 = 1 (1 + 5) mod 5 = 6 mod 5 = 1 (1 + (-1)x 5) mod 5 = -4 mod 5 = 1 (1 + 2 x 5) mod 5 = 11 mod 5 = 1 (1 + (-2)x 5) mod 5 = -9 mod 5 = 1 (1 + 3 x 5) mod 5 = 16 mod 5 = 1 (1 + (-3)x 5) mod 5 = -14 mod 5 = 1 (1 + k. 5) mod 5 = 1 5
e. g. 5 (Page 11) n n Illustration of Lemma 2. 2 E. g. , i = 11 n=5 11 mod 5 = 1 (11 + 5) mod 5 = 16 mod 5 = 1 (11 + (-1)x 5) mod 5 = 6 mod 5 = 1 (11 + 2 x 5) mod 5 = 21 mod 5 = 1 (11 + (-2)x 5) mod 5 = 1 (11 + 3 x 5) mod 5 = 26 mod 5 = 1 (11 + (-3)x 5) mod 5 = -4 mod 5 = 1 (11 + k. 5) mod 5 = 1 6
e. g. 6 (Page 11) n 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 = 5 q + r where q and r are two unique integers and 0 r < 5 Consider 11 + k. 5 = (5 q + r) + k. 5 = 5 q + r + k. 5 = 5 q + k. 5 + r = 5(q + k) + r By the definition of Euclid’s division theorem, (11 + k. 5) mod 5 = r 7
e. g. 7 (Page 12) n n 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 8
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 Conclusion: 2 x 8 mod 9 = ((2 mod 9) (8 mod 9)) mod 9 (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 9
e. g. 8 Claim: (20 + 17) mod 9 = ((20 mod 9) + (17 mod 9)) mod 9 (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 10
Lemma 2. 2 (Y + 9 k) mod 9 = Y mod 9 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 = 9 q 1 + r 1 where q 1 and r 1 are some unique integers. = 9 q 1 + (20 mod 9) By Euclid’s Division Theorem, we can write 17 as follows. 17 = 9 q 2 + r 2 where q 2 and r 2 are some unique integers. = 9 q 2 + (17 mod 9) Consider (20 + 17) mod 9 = {[9 q 1 + (20 mod 9)] + [9 q 2 + (17 mod 9)]} mod 9 = {9 q 1 + (20 mod 9) + 9 q 2 + (17 mod 9)} mod 9 = [ (20 mod 9) + (17 mod 9) + 9 q 1 + 9 q 2] mod 9 = [ (20 mod 9) + (17 mod 9) + 9(q 1 + q 2)] mod 9 = [ (20 mod 9) + (17 mod 9)] mod 9 (by Lemma 2. 2) 11
e. g. 9 (Page 14) n E. g. 0 +5 2 = 2 (0 + 2) mod 5 = 2 n E. g. , 1. 52 = 2 (1. 2) mod 5 = 2 12
e. g. 10 (Page 15) n Illustration of Theorem 2. 4 n Commutative law 2 x 9 8 = 8 x 9 2 2 +9 8 = 8 + 9 2 n Associative law 2 x 9 (8 x 9 1) = (2 x 9 8) x 9 1 2 +9 (8 +9 1) = (2 +9 8) +9 1 n Distributive law 2 x 9 (8 +9 1) = (2 x 9 8) +9 (2 x 9 1) 13
e. g. 11 (Page 24) encryption decryption password I love UST. password kfj. Efklje$3 I love UST. 14
e. g. 11 encryption decryption keroro I love UST. keroro kfj. Efklje$3 I love UST. 15
e. g. 11 encryption decryption keroro I love UST. keroro attacker sender keroro I love UST. kfj. Efklje$3 Undecipherable (cannot be decrypted easily) receiver keroro 16
e. g. 11 encryption 0 I love UST. 17
a b b c c d d e e f f g g h h i i j j k k l l m m n n o o p p q q r r s s t t u u v v w x x y y z z a w encryption 1 I love UST. J mpwf VTU. 18
a c b d c e d f e g f h g i h j i k j l k m l n m o n p o q p r q s r t s u t v u w v x w y x z y a z b encryption 2 I love UST. K nqxg WUV. 19
a d b e c f d g e h f i g j h k i l j m k n l o m p n q o r p s q t r u s v t w u x v y w z x a y b z c encryption 3 I love UST. L oryh XVW. 20
e. g. 12 (Page 32) Encryption function = 5. 12 x Multiplication modn encryption 7 a=5 n = 12 Encrypted value = 5. 12 7 = 5. 7 mod 12 = 35 mod 12 = 11 11 Is there any division modn ? 21
e. g. 13 (Page 32) n Examples that an inverse function exists S f 1 2 3 a 4 d b c T A function! a f-1 T S b c 1 2 3 d 4 22
e. g. 14 (Page 32) n Examples that an inverse function does not T S exist f a 1 2 3 b c 4 Not a function! No such f-1 T a b c S 1 2 3 4 23
Case (a): a = 4, n = 12 f 4, 12 (x) = 4. x mod 12 e. g. 15 (Page 34) S f 4, 12 T 0 1 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 The inverse of f 4, 12 does not exist The receiver cannot determine the original number. Encrypted 3 sender 0 receiver Encrypted 6 sender 0 receiver 24
Case (b): a = 3, n = 12 f 3, 12 (x) = 3. x mod 12 e. g. 16 (Page 35) S f 3, 12 T 0 1 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 The inverse of f 3, 12 does not exist The receiver cannot determine the original number. Encrypted 2 sender 6 receiver Encrypted 6 sender 6 receiver 25
Case (c): a = 5, n = 12 f 5, 12 (x) = 5. x mod 12 e. g. 17 (Page 36) S f 5, 12 T 0 1 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 The inverse of f 5, 12 exists The receiver can uniquely determine the original number. Encrypted 7 sender 11 receiver Encrypted 1 sender 5 receiver 26
e. g. 18 (Page 41) n Private-key cryptosystems Encrypt this message with this private-key Encrypted 5 1 sender Encrypted 5 Decrypt this message with the same private-key Encrypted 5 1 receiver private-key (e. g. , 2) It should be kept privately at the sender’s side. It should be kept privately at the receiver’s side. 27
e. g. 19 (Page 41) n Public-key cryptosystems Encrypt this message with a public-key Encrypted 5 1 sender public key (e. g. , 2) It can be kept publicly. Encrypted 5 Decrypt this message with a secret-key Encrypted 5 1 receiver It has some relationships with the public key. secret-key (e. g. , 4) It should be kept privately at the receiver’s side. 28
This directory is accessible to the public. Public Key Directory e. g. 19 (Page 41) n Raymond 2 Peter 7 Public-key cryptosystems Encrypt this message with a public-key Encrypted 5 1 Peter sender public key (e. g. , 2) It can be kept publicly. Encrypted 5 Decrypt this message with a secret-key Encrypted 5 1 receiver Raymond secret-key (e. g. , 4) It should be kept privately at the receiver’s side. 29
e. g. 20 (Page 44) n An ideal key pair (public key and secret key) n Given a public key, n it is difficult for the adversary to deduce the secret key 30
e. g. 20 n Public-key cryptosystems rev (1000 – M) = rev (1000 – 167) = rev (833) = 338 Encrypted 167 338 sender Encrypted 338 public key It is not secure. Why? 1000 – rev(C) = 1000 – rev (338) = 1000 – 833 = 167 Encrypted 338 167 receiver secret-key 31































