CS6750: Cryptography and Communica7on Security

Size: px
Start display at page:

Download "CS6750: Cryptography and Communica7on Security"

Transcription

1 CS6750: Cryptography and Communica7on Security Class 6: Simple Number Theory Dr. Erik- Oliver Blass

2 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on, group isomorphism, product of groups 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq 7. Ellip7c curves

3 Number theory in cryptography advantages 1. security can (in principle) be based on famous mathema4cal conjectures, 2. the construc7ons have a mathema4cal structure, this allows us to create more advanced construc7ons (public key encryp4on, digital signature schemes, and many others...). 3. the construc7ons have a natural security parameter: size (hence they can be scaled ). Addi4onal advantage a prac4cal applica4on of an area that was never believed to be prac4cal... (wonderful argument for all theore7cians!) 3

4 Number theory in cryptography - disadvantages 1. cryptography based on number theory is much less efficient! 2. the number- theore7c structure may help the cryptoanalyst... 4

5 Number theory as a source of hard problems In this lecture, we will look at some basic number- theore4c problems, iden7fying those that may be useful in cryptography. 5

6 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on, group isomorphism, product of groups 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq 7. Ellip7c curves

7 Famous algorithmic problems in number theory primality tes4ng: input: a є N output: yes if a is a prime, no otherwise this problem is computa4onally easy input: a є N output: factors of a factoring: this problem is believed to be computa4onally hard, if a is a product of two long random primes p and q, of equal length. 7

8 Primality tes7ng x the number that we want to test Sieve of Eratosthenes (ca. 240 BC): takes x steps, which is exponen7al in x = log 2 x Miller- Rabin test (late 1970s) is probabilis4c: if x is prime, it always outputs yes if x is composite, it outputs yes with probability at most ¼. Discuss later Probability is taken only over the internal randomness of the algorithm, so we can iterate! The error goes to zero exponen4ally fast. This algorithm is fast and prac4cal! Determinis4c algorithm of Agrawal, Saxena and Kayal (2002) polynomial, but very inefficient in prac4ce 8

9 Primality tes7ng x the number that we want to test Sieve of Eratosthenes (ca. 240 BC): takes x steps, which is exponen7al in x = log 2 x Miller- Rabin test (late 1970s) is probabilis4c: if x is prime, it always outputs yes if x is composite, it outputs yes with probability at most ¼. Discuss later Probability is taken only over the internal randomness of the algorithm, so we can iterate! The error goes to zero exponen4ally fast. This algorithm is fast and prac4cal! Determinis4c algorithm of Agrawal, Saxena and Kayal (2002) polynomial, but very inefficient in prac4ce 9

10 Primality tes7ng x the number that we want to test Sieve of Eratosthenes (ca. 240 BC): takes x steps, which is exponen7al in x = log 2 x Miller- Rabin test (late 1970s) is probabilis4c: if x is prime, it always outputs yes if x is composite, it outputs yes with probability at most ¼. Discuss later Probability is taken only over the internal randomness of the algorithm, so we can iterate! The error goes to zero exponen4ally fast. This algorithm is fast and prac4cal! Determinis4c algorithm of Agrawal, Kayal and Saxena (2002) polynomial, but very inefficient in prac4ce 10

11 How to select a random prime of length n? Select a random number x and test if it is prime. Prime Number Theorem Let π(n) := number of x s with x {1,...,n}, and x is prime Then lim π(n) n n /ln(n) =1 π(n) n ln(n) For example: if n = , then π(n) Hence, the set of primes is dense. Probability P that a random number is prime: P= π(n) n= à P 0.14% n = 1 ln(n)

12 Factoring is believed to be hard! Factoring assump4on. Take random primes p and q of length n. Set N = pq. No polynomial- 7me algorithm that is given N can find p and q with a non- negligible probability. Factoring is a subject of very intensive research. Currently, N =2048 is believed to be a safe choice. 12

13 So, we have a one- way func7on! f(p,q) = pq is one- way. (assuming the factoring assump7on holds). Using theore7cal results (PRGs), this is enough to construct secure encryp7on schemes. It turns out that we can do much beker: based on number theory, we can construct efficient schemes, that have some very nice addi4onal proper4es (public key cryptography!) But how to do it? We need to some more maths... 13

14 Nota7on Suppose a and b are integers, such that a 0 a b: a divides b, or a is a divisor of b, or a is a factor of b (if a 1 then a is a non- trivial factor of b) gcd(a,b) = the greatest common divisor of a and b If gcd(a,b) = 1, then we say that a and b are co- prime ( rela4vely prime ). 14

15 How to compute gcd(a,b)? Recursion: (assume a b 0) Euclidean algorithm gcd(a,b) = if b a, then return b else return gcd(b, a mod b) It can be shown that this algorithm is correct (induc7on), it terminates in polynomial number of steps. 15

16 compu7ng gcd(185,40): Example a b a mod b this is the result

17 Bézout s iden4ty Claim Let a and b be posi7ve integers. There always exist integers X and Y such that Xa + Yb = gcd (a,b) X and Y can be computed using the extended Euclidian algorithm. 17

18 Example of Extended Euclidian Algorithm compu7ng X and Y such that X Y 40 = 5 a = 185 b = 40 X = - 3 Y = 14 a b a mod b = = = 10 5 = 15 ( ) = 5 5 = = 40 2 ( ) 3 = = 25 + ( ) 2 = = =

19 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on, group isomorphism, product of groups 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq 7. Ellip7c curves

20 Groups A group is a set G along with a binary opera7on such that [closure] for all g,h є G we have g h є G, there exists an iden4ty e є G, such that for all g є G we have e g = g e = g, for every g є G there exists an inverse, that is an element h such that g h = h g = e, [associa4vity] for all g,h,k є G we have g (h k) = (g h) k [commuta4vity] for all g,h є G we have g h = h g order of G = G. if this holds, the group is called abelian 20

21 Addi7ve/mul7plica7ve nota7on Conven4on: [addi4ve nota4on] If the groups opera7on is denoted with +, then: the inverse of g is denoted with - g, the neutral element is denoted with 0, g g (n 7mes) is denoted with ng. [mul4plica4ve nota4on] If the groups opera7on is denoted with, then: some7mes we write gh instead of g h, the inverse of g is denoted with g - 1 or 1/g. the neutral element is denoted with 1, g... g (n 7mes) is denoted with g n (g - 1 ) n is denoted with g - n. Scalar (integer) mul7plica7on Exponen7a7on with integer 21

22 Subgroups A group G is a subgroup of H if G is a subset of H, the group opera7on is the same as in H 22

23 Examples of groups R (reals) is not a group under mul7plica7on. Z (integers): is a group under addi4on (iden7ty element: 0), is not a group under mul4plica4on. Z N = {0,...,N- 1} (integers modulo N) is a group under addi4on modulo N (iden7ty element: 0) If p is a prime, then Z p * = {1,...,p- 1} is a group under mul4plica4on modulo p (iden7ty element: 1) (we will discuss it later) 23

24 Z N is a group under addi4on. Is it also a group under mul4plica4on? No: 0 does not have an inverse. What about other elements of Z N? Only: 1,5,7,11 have an inverse! Why? Because they are co- prime to 12. Example N = 12. Mul7plica7on Table

25 Observa4on/Claim If gcd(a,n) > 1, then for every integer b we have ab mod n 1. Proof Assume (contradic7on!) that ab mod n = 1. Hence, we have: ab = nk + 1 ab - nk = 1 Since gcd(a,n) divides both ab and nk, it also divides ab nk. Thus, gcd(a,n)>1 has to divide 1(= ab nk). Contradic7on. 25

26 Z N * Define Z N * = {a є Z N : gcd(a,n) = 1}. Claim: Then Z N * is an abelian group under mul4plica4on modulo N. Proof First, observe that Z N * is closed under mul4plica4on modulo N. This is because if a,b are co- prime to N, then ab is also co- prime to N. Associa4vity and commuta4vity are trivial. 1 is the iden7ty element. It remains to show that for every a є Z N * there always exist an b є Z N * that is an inverse of a modulo N. We say that b is an inverse of a modulo N, if: a b = 1 mod N 26

27 Lemma Suppose that gcd(a,n) = 1. Then, for every a є Z N * there always exist an element X є Z such that X a = 1 mod N. Proof Since gcd(a,n) = 1, there always exist integers X and Y such that Xa + YN = gcd(a,n) = 1. Therefore: Xa = 1 (mod N). Observa4on Such an X can be efficiently computed (using the extended Euclidian algorithm). 27

28 One more step to show! X (from the previous lemma) can be such that X Z N * What to do? define b := X mod N. We need to show that a b = 1 mod N

29 If b := X mod N then b = X + tn So a b = a (X + tn) = ax + atn = 1 (mod N) Remember that X is such that ax mod N = 1. Hence we are done!

30 An (important) example p a prime Z p * = {1,...,p- 1}. Z p * is an abelian group under mul7plica7on modulo p. 30

31 A simple observa7on For every a,b,c є G. If ac = bc then a = b. Proof ac = bc (ac) c - 1 = (bc) c - 1 a (cc - 1 )= b (cc - 1 ) a 1 = b 1 a = b 31

32 Corollary In every group G and for every element g Є G, the func7on f g : G G f g (x) = x g is a bijec7on. (or, in other words, a permuta4on on G). Why? (See previous proof!) Example: Z 11 * x f(x) f 5 (x) = 5 x mod 11 Composing permuta7ons results in cycles. Let s look now at the cycles that contain 1!

33 Example: f 5 (x) = 5 x mod = 20 = 9 (mod 11) 9 5 = 45 = 1 (mod 11) = 25 = 3 (mod 11) = 15 = 4 (mod 11) 1 5 = 5 (mod 11) 4 3

34 Example: f 10 (x) = 10 x mod

35 Example: f 2 (x) = 2 x mod

36 Order of an element Defini4on An order of g (denoted g ) is the smallest integer i > 0 such that g i = 1. Of course i G g = 5 order: g = 10 order: g = 2 order:

37 G:=Z 11 * m := G = 10 Observa7on g = 5 g = 10 g = Observe: in these examples g m = 1 the order of g divides the order of the group G. we will now show that it s not a coincidence

38 Lemma G an abelian group, m := G, g є G. Then g m = 1. Proof Suppose G = {g 1,...,g m }. Observe that from associa7vity and commuta7vity Hence g m = 1. g 1... g m = (g g 1 )... (g g m ) = g m (g 1... g m ) these are the same elements (permuted), because the func7on f(x) = g x is a permuta7on 38

39 Observa7on G an abelian group, m := G, g є G, i є N. Then g i = g i mod m. Proof Let i = qm + r, r=i mod m, where q is some integer ( 0). We have g i = g qm + r = (g m ) q g r = 1 q g r = g r 39

40 Another way to look at it: m order of the group g m g m+1 g m+2 g m- 1 g 0 g 1 g 2 g m+3 g 3 = 1 g 4 g 5 g 6 g 7

41 Z 11 *: Which orders are possible? For Z 11 *: 1,2,5,10 What do they have in common? 1 9 g = 5 order: g = 10 order: They are the divisors of group order 10 = Z 11 * g = 2 order: g = 1 order: 1 1

42 Subgroups generated by elements Defini4on G a group, g є G, i order of g g := {g 0,g 1,...,g i- 1 } g is a subgroup of G generated by g. g 6 g i- 1 g 0 g 1 g 3 g 2 Why? because: 1. it is closed under mul7plica7on g a g b = ga+b mod i 2. the inverse of every g a exists, and it is equal to g i- a g 5 g 4 Because: g i- a g a = g i = 1

43 Lemma G a group of order m. Suppose, some g є G has order i. Then i m. Proof... 43

44 This is the situa7on, if i m. = g (t+1)i mod m by our previous lemma g 4 g 0 g i 1= g 2i g 3i g 4i

45 What happens otherwise? Suppose i does not divide m. = g (t+1)i mod m by our previous lemma g 4 g 0 g (t+1)i g i So g (t+1)i mod m = 1 1= g 2i g 3i But: 0 < (t+1)i mod m < i g 4i Contradic7on with the assump7on that i is the order of g.

46 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on, product of groups 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq 7. Ellip7c curves

47 Cyclic groups If there exists g such that g = G, then we say that G is cyclic. Such a g is called a generator of G. 47

48 Example 1 is a generator of Z

49 Example 2 is not a generator of Z

50 Observa4on/Claim Every group G of a prime order p is cyclic. Every element g of G, except the iden7ty, is a generator. Proof The order of g has to divide p. So, the only possible orders of g are 1 or p. Only iden7ty has order 1, so all the other elements have order p. 50

51 Another (related) fact Theorem If p is prime, then Z * p is cyclic. We leave it without a proof. We verified that claim is true for p=11 and p= Z 11 * generator g = Z 7 * generator g =

52 Of course: Not every element of is a generator. For example: Z p * has order 2 because (p- 1) ε Z p * (p- 1) 2 = p 2 + 2p + 1 = 1 (mod p)

53 Example of a group that is not cyclic Z 15 *: a The maximal order is 4...

54 How to compute g x for large x? Use the square- and- mul4ply method Example: How to compute g x with x = 429? x in binary compute by squaring g from right to len g 256 g 128 g 64 g 32 g 16 g 8 g 4 g 2 g 1 g 256 g 128 g 32 g 8 g 4 g 1 mul4ply g 256 g 128 g 32 g 8 g 4 g 1 equals to g x 54

55 What about the other direc7on = logarithms? (g a generator) In many groups, inver7ng is hard! f(x) = g x

56 Discrete logarithms Suppose G is cyclic, and g is its generator. For every element y, there exists x such that y = g x Such a x will be called a discrete logarithm of y, and it is denoted as x := log y. In some groups, compu7ng a discrete log is believed to be hard. Informally speaking: f: {0,..., G - 1} G defined as f(x) = g x is believed to be a one- way func4on (in some groups). 56

57 Hardness of the discrete log In Z p * (where p is prime), it is believed to be hard. There exist also other groups, where it is believed to be hard (e.g., based on Ellip4c curves). Of course: if P = NP, then compu7ng discrete log is easy. 57

58 How to define formally the discrete log assump7on We need a defini7on for any security parameter n. Therefore we need an algorithm H that on input n outputs a group : a descrip7on of a cyclic group G of order q, such that q = n, a generator g of G.

59 Example H on input n: outputs a descrip7on for a group Z p * random prime p of length n bits a generator of Z p *

60 The discrete log assump7on For every adversary A, consider the following experiment: n Adversary A output: x with y=g x (G, g, y) Let (G, g) be the output of H(n). Select random y G. We say that a discrete logarithm problem is hard with respect to H, if A Prob. poly- 7me adversary A P(A outputs x such that g x = y)=ε(n) (negligible in n)

61 One way func7on This looks almost the same as saying that f(x) = g x is a one- way func7on. The only difference is that the func7on f depends on the group G that was chosen randomly. We could formalize it, by defining: one- way func7on families

62 A problem f: {0,...,p - 1} Z p * defined as f(x) = g x is believed to be a one- way func4on (informally speaking), but from f(x) one can compute the parity of x. We now show how to do it. 62

63 Quadra7c Residues Defini4on a is a quadra4c residue modulo p, if there exists b such that a = b 2 mod p QR p a set of quadra7c residues modulo p QR p is a subgroup of Z p * Quadra7c Non Residues QNR p := Z p* \ QR p Why? because: 1 є QR if a,a є QR then aa є QR If a є QR, then a - 1 є QR What is the size/order of QR p? 63

64 Example: QR 11 Z 11* : 1 2 f(x) = x 2 Observe: (p x) 2 = p 2-2px + x 2 = x 2 mod p 3 4 QR 11 : Lemma. QR p = Z p* / 2 = (p - 1) / 2 64

65 A proof that QR p = (p - 1) / 2 Claim Let g be a generator of Z p*. Then QR p ={g 2,g 4,...,g p- 1 exponents are even numbers }. Proof Every element x Є Z p * is equal to g i for some i. Hence: x 2 = g 2i mod (p- 1) = g j, where j is even. 65

66 Example: QR 11 = {1,4,5,9,3}!! 1 =1,10!! 3 = 5, !! 4 = 2,9 7 8!! 9 = 3, !! 5 = 4,7

67 Is it easy to test, whether a є QR p? Yes! Observa4on/Claim a є QR p if and only if a (p- 1)/2 = 1 (mod p) Proof ( ) If a є QR p, then a = g 2i. Hence a (p- 1)/2 = (g 2i ) (p- 1)/2 = Remember: Z* p = p- 1 g i(p- 1) = 1. 67

68 a (p- 1)/2 = 1 (mod p) à a є QR p ( ) Suppose a is not a quadra4c residue. Then a = g 2i+1. Hence a (p- 1)/2 = (g 2i+1 ) (p- 1)/2 = g i(p- 1) g (p- 1)/2 = g (p- 1)/2 Why? which cannot be equal to 1 since g is a generator. 68

69 Example Z 11 * (p- 1)/2=(11 1)/2 = is f(x) = x 5 = 1? another way to look at it: Not a coincidence: 1 1 (x (p- 1)/2 ) 2 = 1 implies that x (p- 1)/2 =±

70 Back to our problem g a generator of Z p * f: {0,...,p - 1} Z p * defined as f(x) = g x is a one- way func7on, but from f(x) one can compute the parity of x (by checking if f(x) Є QR)... For some applica7ons this is not good. (but some7mes people do not care) 70

71 How to mi7gate? Instead of working in Z p*, work in its subgroup: QR p How to find a generator of QR p? Choose p that is a safe prime ( strong ), that is: p = 2q + 1, with q prime. Hence QR p has prime order q. Remember: Every element (except of 1) of a group of prime order is its generator! Therefore: every element of QR p is a generator. Nice... 71

72 Example 11 is a safe prime (because 5 is a prime) Z * 11 QR

73 Given x є QR p, can we compute square roots modulo a prime p? Yes! We show it only for p = 3 (mod 4) (for p = 1 (mod 4) this fact also holds, but the algorithm and the proof are too complex). How to compute square root of x in real numbers? One method: compute x ½ Problem ½ doesn t make sense in Z p *...

74 Write p = 4m + 3. Claim: x = x m+1 Proof: (x m+1 ) 2 = x 2(m+1) Hence: order of QR p is equal to (p- 1)/2 = (4m+2)/2 = 2m + 1 x 2m+1 is equal to 1 because of this = x 2m+1+1 = x 2m+1 x 1 = x 1

75 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq

76 Euler s φ func7on Define φ(n) = Z N* = {a є Z N : gcd(a,n) = 1}. Euler s theorem: For every a є Z N*, we have a φ(n) = 1 mod N. (trivially follows from the fact that, for every g є G, we have g G = 1). Special case ( Fermat's likle theorem ) For every prime p and every a є {1,...,p- 1}, we have a p- 1 = 1 mod p. 76

77 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq

78 A cross product of groups ( direct product ) (G, ) and (H, ) groups Define a group (G H, ) as follows: the elements of G H are pairs (g,h), where g є G, and h є H. (g,h) (g,h ) = (g g, h h ). It is easy to verify that it is a group. 78

79 Chinese Remainder Theorem (CRT) Let N = pq, where p and q are two dis4nct primes. Define: f(x) := (x mod p, x mod q) Chinese Remainder Theorem (CRT): f is an isomorphism between 1. Z N and Z p Z q 2. Z N * and Z p * Z q * To prove, it we need to show that f is a homomorphism. between Z N and Z p Z q, and between Z N * and Z p * Z q *. f is a bijec4on: between Z N and Z p Z q, and between Z N * and Z p * Z q *. 79

80 f is a homomorphism Proof: f: Z N Z p Z q is an homomorphism f(a + b) = (a + b mod p, a + b mod q) = (((a mod p) + (b mod p)) mod p, ((a mod q) + (b mod q)) mod q) = (a mod p, a mod q) + (b mod p, b mod q) = f(a) + f(b) 80

81 f is a homomorphism Proof: f: Z N * Z p * Z q * is an homomorphism f(a b) = (a b mod p, a b mod q) = (((a mod p) (b mod p)) mod p, ((a mod q) (b mod q)) mod q) = (a mod p, a mod q) (b mod p, b mod q) = f(a) f(b) 81

82 CRT f(x): an example Z 15 : i i mod 5 i mod i mod i mod

83 If p and q are dis7nct primes, then f : Z N Z p Z q is a bijec7on f(x) := (x mod p, x mod q) Proof: We first show that it is injec7ve. If f(i) = f(j), then because p and q are dis7nct primes i mod p = j mod p p divides i- j and i mod q = j mod q q divides i- j N=pq divides i- j i- j=0 mod N à i = j mod N Since Z N = N = pq = Z p Z q à surjec7ve, and we are done! 83

84 f : Z N * Z p* Z q* is also a bijec7on Since we have shown that f is injec7ve, it is enough to show that Z N* = Z p* Z q* = (p- 1)(q- 1)? Look at Z 15 : Z 5 * Z 3 * Z 15 *

85 N = pq Which elements of Z N are not in Z N *? 0 mul7ples of p: {p,...,(q- 1)p} (there are q- 1 of them) mul7ples of q: {q,...,(p- 1)q} (there are p- 1 of them). These sets are disjoint since p and q are dis7nct prime Summing it up: 1 + (q - 1) + (p - 1) = q + p - 1 = pq - p - q + 1 = (p - 1)(q - 1) So, Z N * has pq - (q + p - 1) elements. Remember this for later! 85

86 How does it look for large p and q? Z N mod p mod q Z N * pq is called RSA modulus Z N * is called an RSA group p q 86

87 Fact (f(x) := (x mod p, x mod q)) f is easy to compute (this is trivial) f - 1 is also easy to compute

88 The inverse of f(x) := (x mod p, x mod q) Let X := p - 1 mod q Y := q - 1 mod p Then g(y 1,y 2 ) := ( p y 2 X + q y 1 Y ) mod pq is the inverse of f. Example p=3, q=5 X := 3-1 mod 5 = 2 Y := 2-1 mod 3 = 2 Then g(y 1,y 2 ) := (10 y y 2 ) mod 15 is the inverse of f(x) = (x mod 3, x mod 5). y 2 = x mod y 1 = x mod

89 More general version of CRT p 1,..., p n such that for every i and j we have gcd(p i,p j )=1 Define f(x) := (x mod p 1,..., x mod p n ) Let M = p 1,...,p n Then f is an isomorphism f : Z M Z p 1... Z pn and f : Z M * Z p 1 *... Z pn * Moreover f and f - 1 can be computed efficiently.

90 Why is it called Chinese theorem Ancient Chinese were using it to calculate the number of soldiers. Suppose we have a group of n soldiers. We know that n < 30 but we don t know n. Let 30 = f(x) = (x mod 2, x mod 3, x mod 5)

91 Example

92 n mod 2 = 1

93 n mod 3 = 1

94 n mod 5 = 3

95 Therefore mod 2 mod 3 mod 5 f - 1 (1,1,3) = 13 Answer: n = 13

96 How to compute φ(n), where N = pq? Of course: if p and q are known, then it is easy to compute φ(n), since φ(n) = (p- 1)(q- 1). Hence, compu7ng φ(n) cannot be more difficult than factoring. Claim Compu7ng φ(n) is as difficult as factoring N. 96

97 Compu7ng φ(n) is as hard as factoring N. Suppose: we can compute φ(n). We know that (p-1)(q-1) = φ(n) pq = N (1) (2) It is a system of 2 equa7ons with 2 unknowns (p and q). We can solve it: (2) (1) p = N/q (N/q - 1)(q - 1) = φ(n) it is a quadra7c equa7on, so we can solve it (in R) q 2 + (φ(n) N 1)q + N = 970

98 Which problems are easy and which are hard in Z N * (N = pq)? mul4plying elements? easy! finding inverse? easy! (Euclidean algorithm) compu4ng φ(n)? hard! - as hard as factoring N raising an element to power e (for a large e)? easy! compu4ng eth root (for a large e)? 98

99 Compu7ng e th root easy or hard? Suppose gcd(e, φ(n)) = 1 We can show that the func7on f(x) = x e mod N (defined over Z N *) has an inverse, namely: f - 1 (y) = y d mod N, where d is the inverse of e in Z φ(n) * In other words: e Є Z φ(n) * (note: a new group!) Moral: If we know φ(n), we can compute roots efficiently. What if we do not know φ(n)?

100 Can we compute the eth root, if we do not know φ(n)? It is conjectured to be hard. This conjecture is called the RSA assump4on. More precisely: RSA assump4on For all probabilis7c polynomial 7me algorithm A, we have: P(x e = y mod N : x := A(y, N, e))=ε( N ) where N = pq with p and q random primes and p = q, y is a random element of Z N *, and e is random element of Z φ(n) *.

101 Ques7on Does the RSA assump4on follow from the assump7on that factoring is hard? We don t know... What can be shown is that compu4ng d from e is not easier than factoring N.

102 f(x) = x e easy Z * N easy (if you know p,q) Z * N believed to be hard (otherwise) Remember: Func7ons like this are called trap- door one- way permuta4ons. f is called RSA func4on. 102

103 Some context N a product of two large primes factoring N is hard P NP compu7ng eth roots in Z N * is hard compu7ng φ(n) hard compu7ng d from e is hard

104 Square roots modulo N=pq So, far we discussed a problem of compu7ng the eth root modulo N. What about the special case with e = 2? Strange: As gcd(2, φ(n)) 1, 2 does not have an inverse in Z φ(n) *. Ques4on Which elements have a square root modulo N?

105 Quadra4c Residues modulo pq Z 15 *: and not p! a a QR(15): 1 4 Observa4on: every quadra7c residue modulo 15 has exactly 4 square roots, and hence QR(15) = Z 15 * / 4.

106 A lemma about QRs modulo pq Claim: For N=pq, we have QR(N) = Z N * / 4. Proof: x є QR(N) iff x = a 2 mod N, for some a iff (by CRT) x = a 2 mod p and x = a 2 mod q iff x mod p є QR(p) and x mod q є QR(q) Z N *: QR(p) mod p QR(q) mod q QR(n)

107 QRs modulo pq an example Z 15 : 1 2 mod mod 5 QR(5) mod mod QR(3) mod mod QR(15) Z 15 *

108 Every z є QR N has exactly 4 square roots More precisely, every z=x 2 has the square roots x ++ and x +-,x - +,x - - such that: x ++ = x (mod p) and x ++ = x (mod q) x +- = x (mod p) and x +- = - x (mod q) x - + = - x (mod p) and x - + = x (mod q) x - - = - x (mod p) and x - - = - x (mod q) equals to x equals to - x

109 Jacobi Symbol + 1 if x Є for any prime p define J QR p p (x) := - 1 otherwise for N=pq define J N (x) := J p (x) J q (x) QR(p) mod p J N (x) := QR(q) mod q QR(N) It is a subgroup of Z N * Z N + := {x : J n (x) = +1} Jacobi symbol can be computed efficiently! (even if p and q are unknown)

110 Algorithmic ques7ons about QR Suppose N=pq Is it easy to test membership in QR(N)? Fact: if one knows p and q yes! Because: 1. tes7ng membership modulo a prime is easy 2. the CRT func7on f(x) := (x mod p, x mod q) can be efficiently computed in both direc7ons What if one does not know p and q?

111 Quadra7c Residuosity Assump7on Z N *: QR(p) QNR(p) a є Z N +? QR(q) QR(n) QNR(q) Quadra4c Residuosity Assump4on (QRA): For a random a є Z N+, it is computa4onally hard to determine whether a є QR(N). Formally: for every polynomial- 4me probabilis7c algorithm D the value: P(D(N, a) = Q(N, a)) 0.5 =ε( N ) Q(N,a) = 1 if a Є QR(N) Q(N,a) = 0 otherwise

112 Conclusion Groups that we have seen: Z p * hard problem: discrete log Z N * for N=pq hard problem: compu4ng the eth root subgroups: QR p and QR N

113 End of Class

114 Other interes7ng groups mul7plica7ve groups of a field GF(2 p ), groups based on the ellip4c curves advantage: much smaller key size in prac7ve

115 Plan 1. Role of number theory in cryptography 2. Classical problems in computa7onal number theory 3. Finite groups 4. Cyclic groups, discrete log 5. Euler s φ func7on, group isomorphism, product of groups 6. Chinese Remainder Theorem, groups Z N *, and QR N, where N=pq 7. Ellip7c curves

116 Ellip7c curves over the reals Let a,b R be two numbers such that 4a b 2 0 A non- singular ellip4c curve is a set E of solu7ons (x,y) R 2 to the equa7on y 2 = x 3 + ax + b together with a special point O called the point at infinity.

117 Infinity (any parallel to y- axis!) Example y 2 = 4x 3-4x + 4

118 An abelian group over an ellip7c curve E ellip7c curve (E,+) a group neutral element: O. P inverse of P = (x,y): P = (x,- y). - P

119 Addi7on Suppose P,Q E \ {O} where P=(x 1,y 1 ) and Q=(x 2,y 2 ). Consider the following cases: 1. x 1 x 2 2. x 1 = x 2 and y 1 = - y 2 3. x 1 = x 2 and y 1 = y 2

120 Case 1: x 1 x 2 P=(x 1,y 1 ) and Q=(x 2,y 2 ) L line through P and Q Q.. R L Fact L intersects E in exactly one point R = (x 3,y 3 ). where:. P P + Q = - R. x 3 = λ 2 - x 1 - x 2 y 3 = λ(x 1 - x 3 ) - y 1 and λ = (y 2 - y 1 )/(x 2 - x 1 )

121 Case 2: x 1 = x 2 and y 1 = - y 2 P=(x 1,y 1 ) and Q=(x 2,y 2 ) P + Q = O. P. Q

122 Case 3: P=(x 1,y 1 ) and Q=(x 2,y 2 ) x 1 = x 2 and y 1 = y 2 L line tangent to E at point R P=Q.. R Fact L intersects E in exactly one point R = (x 3,y 3 ). where: P + Q = - R. x 3 = λ 2 - x 1 - x 2 y 3 = λ(x 1 - x 3 ) - y 1 and λ = (3x 1 2 y 2 + a)/(2y 1 )

123 How to prove that this is a group? Easy to see: addi7on is closed on the set E addi7on is commuta7ve O is an iden7ty every point has an inverse What remains is associa4vity (exercise).

124 How to use these groups in cryptography? Instead of the reals use some finite field. For example Z p, where p is prime. All the formulas remain the same!

125 p +1 2 p E p p Hasse s Theorem Let E be an ellip7c curve defined over Z p where p > 3 is prime.

126 How to use the ellip7c curves in (E,+) - ellip7c curve cryptography? Some7mes (E,+) is cyclic or it contains a large cyclic group (E,+). There are examples of such (E,+) or (E,+) where the discrete- log problem is believed to be computa7onally hard!

W3203 Discrete Mathema1cs. Number Theory. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203

W3203 Discrete Mathema1cs. Number Theory. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203 W3203 Discrete Mathema1cs Number Theory Spring 2015 Instructor: Ilia Vovsha hcp://www.cs.columbia.edu/~vovsha/w3203 1 Outline Communica1on, encryp1on Number system Divisibility Prime numbers Greatest Common

More information

Cryptography CS 555. Topic 18: RSA Implementation and Security. CS555 Topic 18 1

Cryptography CS 555. Topic 18: RSA Implementation and Security. CS555 Topic 18 1 Cryptography CS 555 Topic 18: RSA Implementation and Security Topic 18 1 Outline and Readings Outline RSA implementation issues Factoring large numbers Knowing (e,d) enables factoring Prime testing Readings:

More information

Applied Cryptography and Computer Security CSE 664 Spring 2018

Applied Cryptography and Computer Security CSE 664 Spring 2018 Applied Cryptography and Computer Security Lecture 12: Introduction to Number Theory II Department of Computer Science and Engineering University at Buffalo 1 Lecture Outline This time we ll finish the

More information

Introduction to Information Security

Introduction to Information Security Introduction to Information Security Lecture 5: Number Theory 007. 6. Prof. Byoungcheon Lee sultan (at) joongbu. ac. kr Information and Communications University Contents 1. Number Theory Divisibility

More information

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) 1 Euclid s Algorithm Euclid s Algorithm for computing the greatest common divisor belongs to the oldest known computing procedures

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand 1 Divisibility, prime numbers By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a

More information

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9.1 Chapter 9 Objectives

More information

Basic elements of number theory

Basic elements of number theory Cryptography Basic elements of number theory Marius Zimand By default all the variables, such as a, b, k, etc., denote integer numbers. Divisibility a 0 divides b if b = a k for some integer k. Notation

More information

Topics in Cryptography. Lecture 5: Basic Number Theory

Topics in Cryptography. Lecture 5: Basic Number Theory Topics in Cryptography Lecture 5: Basic Number Theory Benny Pinkas page 1 1 Classical symmetric ciphers Alice and Bob share a private key k. System is secure as long as k is secret. Major problem: generating

More information

Number Theory and Group Theoryfor Public-Key Cryptography

Number Theory and Group Theoryfor Public-Key Cryptography Number Theory and Group Theory for Public-Key Cryptography TDA352, DIT250 Wissam Aoudi Chalmers University of Technology November 21, 2017 Wissam Aoudi Number Theory and Group Theoryfor Public-Key Cryptography

More information

ECEN 5022 Cryptography

ECEN 5022 Cryptography Elementary Algebra and Number Theory University of Colorado Spring 2008 Divisibility, Primes Definition. N denotes the set {1, 2, 3,...} of natural numbers and Z denotes the set of integers {..., 2, 1,

More information

Applied Cryptography and Computer Security CSE 664 Spring 2017

Applied Cryptography and Computer Security CSE 664 Spring 2017 Applied Cryptography and Computer Security Lecture 11: Introduction to Number Theory Department of Computer Science and Engineering University at Buffalo 1 Lecture Outline What we ve covered so far: symmetric

More information

Mathematics for Cryptography

Mathematics for Cryptography Mathematics for Cryptography Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo Waterloo, Ontario, N2L 3G1, Canada March 15, 2016 1 Groups and Modular Arithmetic 1.1

More information

NUMBER THEORY. Anwitaman DATTA SCSE, NTU Singapore CX4024. CRYPTOGRAPHY & NETWORK SECURITY 2018, Anwitaman DATTA

NUMBER THEORY. Anwitaman DATTA SCSE, NTU Singapore CX4024. CRYPTOGRAPHY & NETWORK SECURITY 2018, Anwitaman DATTA NUMBER THEORY Anwitaman DATTA SCSE, NTU Singapore Acknowledgement: The following lecture slides are based on, and uses material from the text book Cryptography and Network Security (various eds) by William

More information

ALG 4.0 Number Theory Algorithms:

ALG 4.0 Number Theory Algorithms: Algorithms Professor John Reif ALG 4.0 Number Theory Algorithms: (a) GCD (b) Multiplicative Inverse (c) Fermat & Euler's Theorems (d) Public Key Cryptographic Systems (e) Primality Testing Greatest Common

More information

CS 4770: Cryptography. CS 6750: Cryptography and Communication Security. Alina Oprea Associate Professor, CCIS Northeastern University

CS 4770: Cryptography. CS 6750: Cryptography and Communication Security. Alina Oprea Associate Professor, CCIS Northeastern University CS 4770: Cryptography CS 6750: Cryptography and Communication Security Alina Oprea Associate Professor, CCIS Northeastern University March 15 2018 Review Hash functions Collision resistance Merkle-Damgaard

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 8 February 1, 2012 CPSC 467b, Lecture 8 1/42 Number Theory Needed for RSA Z n : The integers mod n Modular arithmetic GCD Relatively

More information

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2 8. p-adic numbers 8.1. Motivation: Solving x 2 a (mod p n ). Take an odd prime p, and ( an) integer a coprime to p. Then, as we know, x 2 a (mod p) has a solution x Z iff = 1. In this case we can suppose

More information

Basic Algorithms in Number Theory

Basic Algorithms in Number Theory Basic Algorithms in Number Theory Algorithmic Complexity... 1 Basic Algorithms in Number Theory Francesco Pappalardi Discrete Logs, Modular Square Roots & Euclidean Algorithm. July 20 th 2010 Basic Algorithms

More information

Lecture Notes, Week 6

Lecture Notes, Week 6 YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467b: Cryptography and Computer Security Week 6 (rev. 3) Professor M. J. Fischer February 15 & 17, 2005 1 RSA Security Lecture Notes, Week 6 Several

More information

Introduction to Number Theory 1. c Eli Biham - December 13, Introduction to Number Theory 1

Introduction to Number Theory 1. c Eli Biham - December 13, Introduction to Number Theory 1 Introduction to Number Theory 1 c Eli Biham - December 13, 2012 206 Introduction to Number Theory 1 Division Definition: Let a and b be integers. We say that a divides b, or a b if d s.t. b = ad. If b

More information

Foundations of Cryptography

Foundations of Cryptography Foundations of Cryptography Ville Junnila viljun@utu.fi Department of Mathematics and Statistics University of Turku 2015 Ville Junnila viljun@utu.fi Lecture 7 1 of 18 Cosets Definition 2.12 Let G be a

More information

LECTURE NOTES IN CRYPTOGRAPHY

LECTURE NOTES IN CRYPTOGRAPHY 1 LECTURE NOTES IN CRYPTOGRAPHY Thomas Johansson 2005/2006 c Thomas Johansson 2006 2 Chapter 1 Abstract algebra and Number theory Before we start the treatment of cryptography we need to review some basic

More information

Lecture 3.1: Public Key Cryptography I

Lecture 3.1: Public Key Cryptography I Lecture 3.1: Public Key Cryptography I CS 436/636/736 Spring 2015 Nitesh Saxena Today s Informative/Fun Bit Acoustic Emanations http://www.google.com/search?source=ig&hl=en&rlz=&q=keyboard+acoustic+em

More information

0 Sets and Induction. Sets

0 Sets and Induction. Sets 0 Sets and Induction Sets A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a A to denote that a is an element of the set

More information

Lecture 15 & 16: Trapdoor Permutations, RSA, Signatures

Lecture 15 & 16: Trapdoor Permutations, RSA, Signatures CS 7810 Graduate Cryptography October 30, 2017 Lecture 15 & 16: Trapdoor Permutations, RSA, Signatures Lecturer: Daniel Wichs Scribe: Willy Quach & Giorgos Zirdelis 1 Topic Covered. Trapdoor Permutations.

More information

Lecture 14: Hardness Assumptions

Lecture 14: Hardness Assumptions CSE 594 : Modern Cryptography 03/23/2017 Lecture 14: Hardness Assumptions Instructor: Omkant Pandey Scribe: Hyungjoon Koo, Parkavi Sundaresan 1 Modular Arithmetic Let N and R be set of natural and real

More information

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467a: Cryptography and Computer Security Notes 13 (rev. 2) Professor M. J. Fischer October 22, 2008 53 Chinese Remainder Theorem Lecture Notes 13 We

More information

Public-key Cryptography: Theory and Practice

Public-key Cryptography: Theory and Practice Public-key Cryptography Theory and Practice Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Chapter 2: Mathematical Concepts Divisibility Congruence Quadratic Residues

More information

CSE 521: Design and Analysis of Algorithms I

CSE 521: Design and Analysis of Algorithms I CSE 521: Design and Analysis of Algorithms I Randomized Algorithms: Primality Testing Paul Beame 1 Randomized Algorithms QuickSelect and Quicksort Algorithms random choices make them fast and simple but

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 10 February 19, 2013 CPSC 467b, Lecture 10 1/45 Primality Tests Strong primality tests Weak tests of compositeness Reformulation

More information

Introduction to Cryptography. Lecture 6

Introduction to Cryptography. Lecture 6 Introduction to Cryptography Lecture 6 Benny Pinkas page 1 Public Key Encryption page 2 Classical symmetric ciphers Alice and Bob share a private key k. System is secure as long as k is secret. Major problem:

More information

Public Key Encryption

Public Key Encryption Public Key Encryption 3/13/2012 Cryptography 1 Facts About Numbers Prime number p: p is an integer p 2 The only divisors of p are 1 and p s 2, 7, 19 are primes -3, 0, 1, 6 are not primes Prime decomposition

More information

10 Concrete candidates for public key crypto

10 Concrete candidates for public key crypto 10 Concrete candidates for public key crypto In the previous lecture we talked about public key cryptography and saw the Diffie Hellman system and the DSA signature scheme. In this lecture, we will see

More information

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division Questions/Complaints About Homework? Here s the procedure for homework questions/complaints: 1. Read the solutions first. 2. Talk to the person who graded it (check initials) 3. If (1) and (2) don t work,

More information

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus... PREFACE These notes have been prepared by Dr Mike Canfell (with minor changes and extensions by Dr Gerd Schmalz) for use by the external students in the unit PMTH 338 Number Theory. This booklet covers

More information

CIS 551 / TCOM 401 Computer and Network Security

CIS 551 / TCOM 401 Computer and Network Security CIS 551 / TCOM 401 Computer and Network Security Spring 2008 Lecture 15 3/20/08 CIS/TCOM 551 1 Announcements Project 3 available on the web. Get the handout in class today. Project 3 is due April 4th It

More information

Numbers. Çetin Kaya Koç Winter / 18

Numbers. Çetin Kaya Koç   Winter / 18 Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 18 Number Systems and Sets We represent the set of integers as Z = {..., 3, 2, 1,0,1,2,3,...} We denote the set of positive integers modulo n as

More information

Corollary 4.2 (Pepin s Test, 1877). Let F k = 2 2k + 1, the kth Fermat number, where k 1. Then F k is prime iff 3 F k 1

Corollary 4.2 (Pepin s Test, 1877). Let F k = 2 2k + 1, the kth Fermat number, where k 1. Then F k is prime iff 3 F k 1 4. Primality testing 4.1. Introduction. Factorisation is concerned with the problem of developing efficient algorithms to express a given positive integer n > 1 as a product of powers of distinct primes.

More information

Public-Key Cryptography. Lecture 10 DDH Assumption El Gamal Encryption Public-Key Encryption from Trapdoor OWP

Public-Key Cryptography. Lecture 10 DDH Assumption El Gamal Encryption Public-Key Encryption from Trapdoor OWP Public-Key Cryptography Lecture 10 DDH Assumption El Gamal Encryption Public-Key Encryption from Trapdoor OWP Diffie-Hellman Key-exchange Secure under DDH: (g x,g x,g xy ) (g x,g x,g r ) Random x {0,..,

More information

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS Modular arithmetics that we have discussed in the previous lectures is very useful in Cryptography and Computer Science. Here we discuss several

More information

CSC 5930/9010 Modern Cryptography: Number Theory

CSC 5930/9010 Modern Cryptography: Number Theory CSC 5930/9010 Modern Cryptography: Number Theory Professor Henry Carter Fall 2018 Recap Hash functions map arbitrary-length strings to fixedlength outputs Cryptographic hashes should be collision-resistant

More information

Katz, Lindell Introduction to Modern Cryptrography

Katz, Lindell Introduction to Modern Cryptrography Katz, Lindell Introduction to Modern Cryptrography Slides Chapter 8 Markus Bläser, Saarland University Weak factoring experiment The weak factoring experiment 1. Choose two n-bit integers x 1, x 2 uniformly.

More information

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time. 8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only

More information

Introduction to Cryptology. Lecture 20

Introduction to Cryptology. Lecture 20 Introduction to Cryptology Lecture 20 Announcements HW9 due today HW10 posted, due on Thursday 4/30 HW7, HW8 grades are now up on Canvas. Agenda More Number Theory! Our focus today will be on computational

More information

5 Group theory. 5.1 Binary operations

5 Group theory. 5.1 Binary operations 5 Group theory This section is an introduction to abstract algebra. This is a very useful and important subject for those of you who will continue to study pure mathematics. 5.1 Binary operations 5.1.1

More information

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2006 Contents 9 Introduction to Number Theory and Cryptography 1 9.1 Subgroups

More information

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost? Ch - Algorithms with numbers Addition Basic arithmetic Addition ultiplication Division odular arithmetic factoring is hard Primality testing 53+35=88 Cost? (n number of bits) O(n) ultiplication al-khwārizmī

More information

8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

More information

Number Theory. Modular Arithmetic

Number Theory. Modular Arithmetic Number Theory The branch of mathematics that is important in IT security especially in cryptography. Deals only in integer numbers and the process can be done in a very fast manner. Modular Arithmetic

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security Outline Quadratic residues Useful tests Digital Signatures CPSC 467b: Cryptography and Computer Security Lecture 14 Michael J. Fischer Department of Computer Science Yale University March 1, 2010 Michael

More information

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2 Contents 1 Recommended Reading 1 2 Public Key/Private Key Cryptography 1 2.1 Overview............................................. 1 2.2 RSA Algorithm.......................................... 2 3 A Number

More information

ECE596C: Handout #11

ECE596C: Handout #11 ECE596C: Handout #11 Public Key Cryptosystems Electrical and Computer Engineering, University of Arizona, Loukas Lazos Abstract In this lecture we introduce necessary mathematical background for studying

More information

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory

More information

4 Powers of an Element; Cyclic Groups

4 Powers of an Element; Cyclic Groups 4 Powers of an Element; Cyclic Groups Notation When considering an abstract group (G, ), we will often simplify notation as follows x y will be expressed as xy (x y) z will be expressed as xyz x (y z)

More information

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 9 February 6, 2012 CPSC 467b, Lecture 9 1/53 Euler s Theorem Generating RSA Modulus Finding primes by guess and check Density of

More information

Lecture 6: Deterministic Primality Testing

Lecture 6: Deterministic Primality Testing Lecture 6: Deterministic Primality Testing Topics in Pseudorandomness and Complexity (Spring 018) Rutgers University Swastik Kopparty Scribe: Justin Semonsen, Nikolas Melissaris 1 Introduction The AKS

More information

Lemma 1.2. (1) If p is prime, then ϕ(p) = p 1. (2) If p q are two primes, then ϕ(pq) = (p 1)(q 1).

Lemma 1.2. (1) If p is prime, then ϕ(p) = p 1. (2) If p q are two primes, then ϕ(pq) = (p 1)(q 1). 1 Background 1.1 The group of units MAT 3343, APPLIED ALGEBRA, FALL 2003 Handout 3: The RSA Cryptosystem Peter Selinger Let (R, +, ) be a ring. Then R forms an abelian group under addition. R does not

More information

PRIMALITY TESTING. Professor : Mr. Mohammad Amin Shokrollahi Assistant : Mahdi Cheraghchi. By TAHIRI JOUTI Kamal

PRIMALITY TESTING. Professor : Mr. Mohammad Amin Shokrollahi Assistant : Mahdi Cheraghchi. By TAHIRI JOUTI Kamal PRIMALITY TESTING Professor : Mr. Mohammad Amin Shokrollahi Assistant : Mahdi Cheraghchi By TAHIRI JOUTI Kamal TABLE OF CONTENTS I- FUNDAMENTALS FROM NOMBER THEORY FOR RANDOMIZED ALGORITHMS:.page 4 1)

More information

A. Algebra and Number Theory

A. Algebra and Number Theory A. Algebra and Number Theory Public-key cryptosystems are based on modular arithmetic. In this section, we summarize the concepts and results from algebra and number theory which are necessary for an understanding

More information

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory. CSS322: Security and Cryptography Sirindhorn International Institute of Technology Thammasat University Prepared by Steven Gordon on 29 December 2011 CSS322Y11S2L06, Steve/Courses/2011/S2/CSS322/Lectures/number.tex,

More information

1 Rabin Squaring Function and the Factoring Assumption

1 Rabin Squaring Function and the Factoring Assumption COMS W461 Introduction to Cryptography October 11, 005 Lecture 11: Introduction to Cryptography Lecturer: Tal Malkin Scribes: Kate McCarthy, Adam Vartanian Summary In this lecture we will prove that Rabin

More information

7. Let K = 15 be the subgroup of G = Z generated by 15. (a) List the elements of K = 15. Answer: K = 15 = {15k k Z} (b) Prove that K is normal subgroup of G. Proof: (Z +) is Abelian group and any subgroup

More information

Primality Testing. 1 Introduction. 2 Brief Chronology of Primality Testing. CS265/CME309, Fall Instructor: Gregory Valiant

Primality Testing. 1 Introduction. 2 Brief Chronology of Primality Testing. CS265/CME309, Fall Instructor: Gregory Valiant CS265/CME309, Fall 2018. Instructor: Gregory Valiant Primality Testing [These notes may not be distributed outside this class without the permission of Gregory Valiant.] 1 Introduction Prime numbers are

More information

Introduction to Modern Cryptography. Benny Chor

Introduction to Modern Cryptography. Benny Chor Introduction to Modern Cryptography Benny Chor RSA Public Key Encryption Factoring Algorithms Lecture 7 Tel-Aviv University Revised March 1st, 2008 Reminder: The Prime Number Theorem Let π(x) denote the

More information

Name: Solutions Final Exam

Name: Solutions Final Exam Instructions. Answer each of the questions on your own paper. Be sure to show your work so that partial credit can be adequately assessed. Put your name on each page of your paper. 1. [10 Points] All of

More information

A Guide to Arithmetic

A Guide to Arithmetic A Guide to Arithmetic Robin Chapman August 5, 1994 These notes give a very brief resumé of my number theory course. Proofs and examples are omitted. Any suggestions for improvements will be gratefully

More information

Lecture 11: Number Theoretic Assumptions

Lecture 11: Number Theoretic Assumptions CS 6903 Modern Cryptography April 24, 2008 Lecture 11: Number Theoretic Assumptions Instructor: Nitesh Saxena Scribe: Robert W.H. Fisher 1 General 1.1 Administrative Homework 3 now posted on course website.

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

More information

Euler s, Fermat s and Wilson s Theorems

Euler s, Fermat s and Wilson s Theorems Euler s, Fermat s and Wilson s Theorems R. C. Daileda February 17, 2018 1 Euler s Theorem Consider the following example. Example 1. Find the remainder when 3 103 is divided by 14. We begin by computing

More information

Factorization & Primality Testing

Factorization & Primality Testing Factorization & Primality Testing C etin Kaya Koc http://cs.ucsb.edu/~koc koc@cs.ucsb.edu Koc (http://cs.ucsb.edu/~ koc) ucsb ccs 130h explore crypto fall 2014 1/1 Primes Natural (counting) numbers: N

More information

Part IA Numbers and Sets

Part IA Numbers and Sets Part IA Numbers and Sets Definitions Based on lectures by A. G. Thomason Notes taken by Dexter Chua Michaelmas 2014 These notes are not endorsed by the lecturers, and I have modified them (often significantly)

More information

Lecture 11 - Basic Number Theory.

Lecture 11 - Basic Number Theory. Lecture 11 - Basic Number Theory. Boaz Barak October 20, 2005 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are non-negative integers. We say that a divides b,

More information

Finite Fields. Mike Reiter

Finite Fields. Mike Reiter 1 Finite Fields Mike Reiter reiter@cs.unc.edu Based on Chapter 4 of: W. Stallings. Cryptography and Network Security, Principles and Practices. 3 rd Edition, 2003. Groups 2 A group G, is a set G of elements

More information

Introduction to Cryptology. Lecture 19

Introduction to Cryptology. Lecture 19 Introduction to Cryptology Lecture 19 Announcements HW6 due today HW7 due Thursday 4/20 Remember to sign up for Extra Credit Agenda Last time More details on AES/DES (K/L 6.2) Practical Constructions of

More information

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z: NUMBER SYSTEMS Number theory is the study of the integers. We denote the set of integers by Z: Z = {..., 3, 2, 1, 0, 1, 2, 3,... }. The integers have two operations defined on them, addition and multiplication,

More information

Chapter 4 Finite Fields

Chapter 4 Finite Fields Chapter 4 Finite Fields Introduction will now introduce finite fields of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public Key concern operations on numbers what constitutes a number

More information

Math 2070BC Term 2 Weeks 1 13 Lecture Notes

Math 2070BC Term 2 Weeks 1 13 Lecture Notes Math 2070BC 2017 18 Term 2 Weeks 1 13 Lecture Notes Keywords: group operation multiplication associative identity element inverse commutative abelian group Special Linear Group order infinite order cyclic

More information

2 More on Congruences

2 More on Congruences 2 More on Congruences 2.1 Fermat s Theorem and Euler s Theorem definition 2.1 Let m be a positive integer. A set S = {x 0,x 1,,x m 1 x i Z} is called a complete residue system if x i x j (mod m) whenever

More information

Instructor: Bobby Kleinberg Lecture Notes, 25 April The Miller-Rabin Randomized Primality Test

Instructor: Bobby Kleinberg Lecture Notes, 25 April The Miller-Rabin Randomized Primality Test Introduction to Algorithms (CS 482) Cornell University Instructor: Bobby Kleinberg Lecture Notes, 25 April 2008 The Miller-Rabin Randomized Primality Test 1 Introduction Primality testing is an important

More information

Congruence Classes. Number Theory Essentials. Modular Arithmetic Systems

Congruence Classes. Number Theory Essentials. Modular Arithmetic Systems Cryptography Introduction to Number Theory 1 Preview Integers Prime Numbers Modular Arithmetic Totient Function Euler's Theorem Fermat's Little Theorem Euclid's Algorithm 2 Introduction to Number Theory

More information

A polytime proof of correctness of the Rabin-Miller algorithm from Fermat s Little Theorem

A polytime proof of correctness of the Rabin-Miller algorithm from Fermat s Little Theorem A polytime proof of correctness of the Rabin-Miller algorithm from Fermat s Little Theorem Grzegorz Herman and Michael Soltys November 24, 2008 Abstract Although a deterministic polytime algorithm for

More information

Discrete Mathematics GCD, LCM, RSA Algorithm

Discrete Mathematics GCD, LCM, RSA Algorithm Discrete Mathematics GCD, LCM, RSA Algorithm Abdul Hameed http://informationtechnology.pk/pucit abdul.hameed@pucit.edu.pk Lecture 16 Greatest Common Divisor 2 Greatest common divisor The greatest common

More information

Groups, Rings, and Finite Fields. Andreas Klappenecker. September 12, 2002

Groups, Rings, and Finite Fields. Andreas Klappenecker. September 12, 2002 Background on Groups, Rings, and Finite Fields Andreas Klappenecker September 12, 2002 A thorough understanding of the Agrawal, Kayal, and Saxena primality test requires some tools from algebra and elementary

More information

Introduction to Elliptic Curve Cryptography. Anupam Datta

Introduction to Elliptic Curve Cryptography. Anupam Datta Introduction to Elliptic Curve Cryptography Anupam Datta 18-733 Elliptic Curve Cryptography Public Key Cryptosystem Duality between Elliptic Curve Cryptography and Discrete Log Based Cryptography Groups

More information

CSE20: Discrete Mathematics

CSE20: Discrete Mathematics Spring 2018 Today Greatest Common Divisor (GCD) Euclid s algorithm Proof of Correctness Reading: Chapter 4.3 Primes and GCD Universe: U = N = {0, 1, 2,...} a divides b (written a b) iff k.b = ak Set of

More information

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. 2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say

More information

PRIME NUMBERS YANKI LEKILI

PRIME NUMBERS YANKI LEKILI PRIME NUMBERS YANKI LEKILI We denote by N the set of natural numbers: 1,2,..., These are constructed using Peano axioms. We will not get into the philosophical questions related to this and simply assume

More information

Polynomials and Gröbner Bases

Polynomials and Gröbner Bases Alice Feldmann 16th December 2014 ETH Zürich Student Seminar in Combinatorics: Mathema:cal So

More information

Introduction to Cybersecurity Cryptography (Part 5)

Introduction to Cybersecurity Cryptography (Part 5) Introduction to Cybersecurity Cryptography (Part 5) Prof. Dr. Michael Backes 13.01.2017 February 17 th Special Lecture! 45 Minutes Your Choice 1. Automotive Security 2. Smartphone Security 3. Side Channel

More information

1 The Fundamental Theorem of Arithmetic. A positive integer N has a unique prime power decomposition. Primality Testing. and. Integer Factorisation

1 The Fundamental Theorem of Arithmetic. A positive integer N has a unique prime power decomposition. Primality Testing. and. Integer Factorisation 1 The Fundamental Theorem of Arithmetic A positive integer N has a unique prime power decomposition 2 Primality Testing Integer Factorisation (Gauss 1801, but probably known to Euclid) The Computational

More information

Computer Science COMP-547A Cryptography and Data Security

Computer Science COMP-547A Cryptography and Data Security Computer Science COMP-547A Cryptography and Data Security Claude Crépeau These notes are, largely, transcriptions by Anton Stiglic of class notes from the former course Cryptography and Data Security (308-647A)

More information

A Few Primality Testing Algorithms

A Few Primality Testing Algorithms A Few Primality Testing Algorithms Donald Brower April 2, 2006 0.1 Introduction These notes will cover a few primality testing algorithms. There are many such, some prove that a number is prime, others

More information

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm April 11, 2010 1 Algebra We start by discussing algebraic structures and their properties. This is presented in more depth than what we

More information

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 14 October 23, 2017 CPSC 467, Lecture 14 1/42 Computing in Z n Modular multiplication Modular inverses Extended Euclidean algorithm

More information

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2000 2013 Contents 9 Introduction to Number Theory 63 9.1 Subgroups

More information

Outline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m

Outline. Some Review: Divisors. Common Divisors. Primes and Factors. b divides a (or b is a divisor of a) if a = mb for some m Outline GCD and Euclid s Algorithm AIT 682: Network and Systems Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography Modulo Arithmetic Modular Exponentiation Discrete Logarithms

More information

Outline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms

Outline. AIT 682: Network and Systems Security. GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation Discrete Logarithms AIT 682: Network and Systems Security Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography Instructor: Dr. Kun Sun Outline GCD and Euclid s Algorithm Modulo Arithmetic Modular Exponentiation

More information

1. Algebra 1.7. Prime numbers

1. Algebra 1.7. Prime numbers 1. ALGEBRA 30 1. Algebra 1.7. Prime numbers Definition Let n Z, with n 2. If n is not a prime number, then n is called a composite number. We look for a way to test if a given positive integer is prime

More information