500 likes | 509 Views
Page 1. Part IV of Course. Objective: Application of Number Theory in Computer security. Number theory has a long history E.g.: Chinese Remainder Theorem: 2300 years old. Regarded as useless until recently. L13: Intro to Crypto and Modulus. Objective:
E N D
Page 1 Part IV of Course • Objective: Application of Number Theory in Computer security. • Number theory has a long history • E.g.: Chinese Remainder Theorem: 2300 years old • Regarded as useless until recently
L13: Intro to Crypto and Modulus • Objective: • Basic Number Theory concepts for Part II • Introduction to Cryptography • Reading • Textbook, pp. 89-102
Outline • Outline • Modular Arithmetic: mod n • Operations on the set Zn • Introduction Cryptography • Private-Key Cryptography • Caesar cipher: Using addition mod n • Crypto using multiplication mod n • Public-Key Cryptography
Modular Arithmetic Page 6 6 5 4 5 2 5 2 5 2 4 1 2 5 0 25 mod 5 = 0 25 mod 4 = 1 Dividend = Quotient x Divisor + Remainder
Euclid’s Division Theorem • If m = n q’ + r’, 0<= r’ <n • Then q’=q, r’=r • Examples • m=25, n=4 • 25 = 4 x 6 +1 • q=6, r=1 • m=-25, n=4 • -25 = 4 x (-7) +3 • q=-7, r=3 • Will be proved later
Modular Arithmetic • Applies also to the case when m is negative. * 25 mod 4 = 1 because 25 = 4 * 6 + 1 , and 25 = 4 * q + r cannot be satisfied for 0 ≤ r < 1 , i.e. r = 0
Modular Arithmetic • Applies also to the case when m is negative. * - 25 mod 4 = 3 because - 25 = 4 * (- 7) + 3 , and - 25 = 4 * q + r cannot be satisfied for 0 ≤ r < 3 , i.e. r = 0,1,2
Modular Arithmetic/Simple Properties • Note • [-25 mod 4] = 4 - [25 mod 4] • In general 25 Mod 4 = 1 - 25 mod 4 = 3 Example: 5 mod 4 = 1, (-5) mod 4 = 3 6 mod 4 = 2, (-6) mod 4 = 2
Modular Arithmetic/Properties Page 11 21 mod 9 = 38 mod 9 = 3 2 (21 + 38 ) mod 9 = 59 mod 9 = 5 So ( 21 + 38 ) mod 9 = ( 21 mod 9 ) + ( 38 mod 9 ) ( a + b) mod n = ( a mod n ) +( b mod n ) True in General ? No! Counter Example ≠ ( 2 mod 9) + ( 8 mod 9 ) ( 2 + 8 ) mod 9 2 + 8 1 10
Modular Arithmetic/Properties Examples Page 12 25 mod 4 = 1 1 ( 25 + 2 * 4 ) mod 4 = 33 mod 4 = ( 25 – 3 * 4 ) mod 4 = 13 mod 4 = 1
Intuition • Adding multiples of n to i changes the quotient, but not the remainder. +1 +4 +4
Page 14 Proof of Lemm 2.2 * From (*) we get i + kn = n· (q + k) + r (***) 0 ≤ r <n * By Euclid’s Division theorem, Exist unique q ,r (0 ≤ r < n ) s.t i = n*q + r ( * ) * By definition of mod, i mod n = r * Because of ( ** ),( *** ) r’ = r ( Division Theorem ) * Similarly ,exists unique q’, r’ ( 0 ≤ r’ < n ) s.t. i + kn = n · q’ + r’ ( ** ) * That is i mod n = ( i + kn ) mod n * By definition of mod (i + kn ) mod n = r’ Proved
Modular Arithmetic/Properties Page 11 • An additional property • (i mod mn) mod n = i mod n • Proof: • i = qmn + s, 0<=s<mn • s =pn + r, 0<=r <n. • Then: (i mod mn) mod n =r • On the other hand • i = (qm+p)n + r, 0<=r<n • So, i mod n = r • The equation is proved.
L09: Intro to Crypto and Modulus • Modular Arithmetic: mod n • Operations on the set • Introduction Cryptography • Private-Key Cryptography • Caesar cipher: Using addition mod n • Cryto using multiplication mod n • Public-Key Cryptography
Modulo Arithmetic on the Set • Operations on
Page 19 n = 12 Examples of “+ n ”, “ ·n ” 3 +n5 = ( 3 + 5) mod n = 8 mod 12 = 8 7 +n8 = ( 7 + 8 ) mod 12 = 3 2 ·n 4 = 2 · 4 mod n = 8 mod 12 = 8 3 ·n 4 = 3 · 4 mod n = 12 mod 12 = 0 3 ·n 5 = 3
Properties of Operations on Page 21 * ·n commutative a ·n b = a · b mod n = b · a mod n = b ·n a * +n commutative a +n b = ( a + b ) mod n = ( b + a ) mod n = b +n a
Properties of Operations on • Does each • Has additive inverse? • Yes. -x mod n • Has multiplicative inverse? • Major question to be discussed later.
L09: Intro to Crypto and Modulus • Modular Arithmetic: mod n • Operations on the set • Introduction Cryptography • Private-Key Cryptography • Caesar cipher: Using addition mod n • Cryto using multiplication mod n • Public-Key Cryptography
L09: Intro to Crypto and Modulus • Modular Arithmetic: mod n • Modulo arithmetic on the set • Introduction Cryptography • Private-Key Cryptography • Caesar cipher: Using addition mod n • Crypto using multiplication mod n • Public-Key Cryptography
Caeser Cipher and Mod 26 • Encrypting • Decrypting: • E.G. s=2 • Plaintext message: SEA 18 4 0 • Cipher text: • Decrypted message:
Caeser Cipher and Mod 26 Page 31 * Plaintext: SEA18 4 0 * Encrypt: ( n + 13 ) mod 26 5 17 13 * Decrypt: ( n’ – 13 ) mod 26 ( 5 – 13 ) mod 26 = -8 mod 26 = ( -8 = 26 · ( -1) + 18 ) 18 ( 17 – 13 ) mod 26 = 4 Get back 18 4 0 S E A
L09: Intro to Crypto and Modulus • Modular Arithmetic: mod n • Operations on the set • Introduction Cryptography • Private-Key Cryptography • Caesar cipher: Using addition mod n • Crypto using multiplication mod n • Public-Key Cryptography
Cryptography with Multiplication mod n • Also possible to implement crypto system using multiplication mod n • Need to deal with an important new issue. • Plaintext: 5 7 8 • Ciphertext: 1 11 4
Cryptography with Multiplicationmod n Page 36 Encrypt: f (x) = a ·n x Decrypt ? n = 12 , a = 6 X = 3 →6*3 mod 12 = 6 f g →(6÷6 )mod 12 = 1 X’ = 6 Naive idea: x ·n a =( x · a) mod n Define: x ÷n a =( x ÷ a) mod n Don’t get back 3 ! ÷n not well defined 1÷n 6 = (1 ÷ 6) mod n Decrypt: g (x’) = x’ ÷n a = 0.166 mod n Not integer
Cryptography with Multiplicationmod n Page 37 Another idea: If exists b∈zn, s.t. b·n a = 1 Can set : g (x’) = b ·n x’ f x → a ·n x Encrypt: g → Decrypt: x’ = a ·n x b ·n ( a·n x ) = ( b ·n a ) ·n x Works ! = x = 1 ·n x b: inverse of a in zn denoted by a a exist ? -1 -1 -1 f exist ? g: inverse of f denoted by f -1
L09: Intro to Crypto and Modulus • Modular Arithmetic: mod n • Operations on the set • Introduction Cryptography • Private-Key Cryptography • Caesar cipher: Using addition mod n • Crypto using multiplication mod n • Public-Key Cryptography
Public-Key Cryptosystem Page 46 Conditions for public-key Crpto system to work * SB ( PB ( M )) = M * This is not easy PB, PB( M ) => M PB => SB Very hard to prevent PB => SB
Is Public-Key Cryptosystem Possible? • Need a function whose inverse is DIFFICULT to compute without private key. Sounds almost impossible. • In 1970’s, Rivest, Shamir and Adelman figured out how to do this using modular arithmetic • The result: RSA public-key crypto-system. L11 Conditions for public-key Crypto System to work * SB (PB( M )) = M * This is not easy PB, PB( M )=> M PB => SB