310 likes | 385 Views
Intro to Crypto and Mod. Supplementary Notes. Prepared by Raymond Wong. Presented by Raymond Wong. e.g.1 (Page 4). 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.
E N D
Intro to Crypto and Mod Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong
e.g.1 (Page 4) • 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
e.g.2 (Page 9) • Illustration of [(-m) mod n] = n – [m mod n] • E.g., m = 4 n = 5E.g., m = 9 n = 5 4 mod 5 = 4 -4 mod 5 = 5 – (4 mod 5) = 5 – 4 = 1 9 mod 5 = 4 -9 mod 5 = 5 – (9 mod 5) = 5 – 4 = 1
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)
e.g.4 (Page 11) • Illustration of Lemma 2.2 • E.g., i = 1 n = 5 1 mod 5 = 1 (1 + (-1)x5) mod 5 = -4 mod 5 = 1 (1 + 5) mod 5 = 6 mod 5 = 1 (1 + (-2)x5) mod 5 = -9 mod 5 = 1 (1 + 2x5) mod 5 = 11 mod 5 = 1 (1 + (-3)x5) mod 5 = -14 mod 5 = 1 (1 + 3x5) mod 5 = 16 mod 5 = 1 (1 + k.5) mod 5 = 1
e.g.5 (Page 11) • Illustration of Lemma 2.2 • E.g., i = 11 n = 5 11 mod 5 = 1 (11 + (-1)x5) mod 5 = 6 mod 5 = 1 (11 + 5) mod 5 = 16 mod 5 = 1 (11 + 2x5) mod 5 = 21 mod 5 = 1 (11 + (-2)x5) mod 5 = 1 mod 5 = 1 (11 + 3x5) mod 5 = 26 mod 5 = 1 (11 + (-3)x5) mod 5 = -4 mod 5 = 1 (11 + k.5) mod 5 = 1
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 + 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
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
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
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
e.g.8 Lemma 2.2 (Y + 9k) mod 9 = Y mod 9 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 = 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 (by Lemma 2.2)
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
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)
encryption decryption I love UST. kfjEfklje$3 e.g.11 (Page 24) password password I love UST.
encryption decryption I love UST. kfjEfklje$3 e.g.11 keroro keroro I love UST.
encryption decryption I love UST. kfjEfklje$3 kfjEfklje$3 e.g.11 keroro keroro I love UST. Undecipherable (cannot be decrypted easily) attacker sender receiver keroro keroro
I love UST. e.g.11 encryption 0 I love UST.
J mpwf VTU. z b c d e f g h i j k a m o p q r s t u v w x y l n encryption 1 I love UST.
K nqxg WUV. a c d e f g h i j k l b n p q r s t u v w x y z m o encryption 2 I love UST.
L oryh XVW. b d e f g h i j k l m c o q r s t u v w x y z a n p encryption 3 I love UST.
11 e.g.12 (Page 32) Encryption function = 5 .12 x Multiplication modn encryption a = 5 n = 12 Is there any division modn ? 7 Encrypted value = 5 .12 7 = 5 . 7 mod 12 = 35 mod 12 = 11
e.g.13 (Page 32) • Examples that an inverse function exists T S a 1 2 b f 3 c d 4 S T A function! a 1 2 b f-1 3 c d 4
e.g.14 (Page 32) • Examples that an inverse function does not exist T S a 1 2 b f 3 c 4 S T Not a function! a 1 2 b No such f-1 3 c 4
Encrypted Encrypted 0 6 0 3 e.g.15 (Page 34) Case (a): a = 4, n = 12 f4, 12 (x) = 4.x mod 12 The inverse of f4, 12 does not exist S T 0 0 1 1 The receiver cannot determine the original number. 2 2 3 3 4 4 f4, 12 5 5 6 6 sender receiver 7 7 8 8 9 9 10 10 sender receiver 11 11
Encrypted Encrypted 6 6 6 2 e.g.16 (Page 35) Case (b): a = 3, n = 12 f3, 12 (x) = 3.x mod 12 The inverse of f3, 12 does not exist S T 0 0 1 1 The receiver cannot determine the original number. 2 2 3 3 4 4 f3, 12 5 5 6 6 sender receiver 7 7 8 8 9 9 10 10 sender receiver 11 11
Encrypted Encrypted 5 1 11 7 e.g.17 (Page 36) Case (c): a = 5, n = 12 f5, 12 (x) = 5.x mod 12 The inverse of f5, 12 exists S T 0 0 1 1 The receiver can uniquely determine the original number. 2 2 3 3 4 4 f5, 12 5 5 6 6 sender receiver 7 7 8 8 9 9 10 10 sender receiver 11 11
Encrypted Encrypted Encrypted 1 5 5 1 5 e.g.18 (Page 41) • Private-key cryptosystems Encrypt this message with this private-key Decrypt this message with the same private-key sender receiver private-key (e.g., 2) 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.
Encrypted Encrypted Encrypted 5 1 5 5 1 e.g.19 (Page 41) • Public-key cryptosystems Encrypt this message with a public-key Decrypt this message with a secret-key It has some relationships with the public key. sender receiver public key (e.g., 2) secret-key (e.g., 4) It can be kept publicly. It should be kept privately at the receiver’s side.
Public Key Directory Encrypted Encrypted Encrypted 5 1 5 5 1 e.g.19 (Page 41) This directory is accessible to the public. Raymond 2 Peter 7 • Public-key cryptosystems Encrypt this message with a public-key Decrypt this message with a secret-key Peter Raymond sender receiver public key (e.g., 2) secret-key (e.g., 4) It can be kept publicly. It should be kept privately at the receiver’s side.
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
Encrypted Encrypted Encrypted 338 167 338 167 338 e.g.20 • Public-key cryptosystems rev (1000 – M) = rev (1000 – 167) = rev (833) = 338 1000 – rev(C) = 1000 – rev (338) = 1000 – 833 = 167 sender receiver public key secret-key It is not secure. Why?