Number Theory and Advanced Cryptography 2 Number Theory and Advanced Cryptography 2. Primes and Discrete Logarithms Part I: Introduction to Number Theory Part II: Advanced Cryptography Chih-Hung Wang Feb. 2011
The distribution of primes The natural way of measuring the density of primes is to count the number of primes up to a bound x, where x is a real number. For a real number x ¸ 0, the function (x) is defined to be the number of primes up to x. Thus, (1) = 0, (2) = 1, (7.5) = 4, and so on.
Some values of (x)
The Sieve of Eratosthenes This is an algorithm for generating all the primes up to a given bound k.
The prime number theorem
The error term in the prime number theory (1)
The error term in the prime number theory (2)
Sophie Germain primes
Probabilistic primality testing Trial Division
Trial division
The Miller-Rabin test
Error parameter (1)
Error parameter (2)
Carmichael numbers
Good Primality testing (1)
Good Primality testing (2)
Error parameter
Generating random primes using the Miller-Rabin Test
Sieving up to a small bound
Generating a random k-bit prime
Perfect power testing (1)
Perfect power testing (2)
Perfect power testing (3)
Deterministic Primality Testing The basic idea
AKS algorithm
Running time
Notes
Primality testing in Java Public BigInteger ( int bitLength,int certainty,Random rnd ) Public boolean isProbablePrime (int certainty)
Cyclic groups Order of group element
Order of group element
(Example)Powers of Integers, Modulo 19
Cyclic group & Group generator
Example of Cyclic Group
Theorem of Cyclic Group
Prime Order group
The Multiplicative Group Zn*
The Multiplicative Group Zn*
Example of The Multiplicative Group
Finding Primitive Root Page 166
Application 1: Diffie-Hellman Key Exchange Diffie and Hellman 1976 A number of commercial products employ this key exchange technique This algorithm enables two users to exchange key securely
The Diffie-Hellman Key Exchange Protocol
Example of D-H Key Exchange (1) q=97 =5 XA = 36 XB=58 YA=536=50 mod 97 YB=558=44 mod 97 K=(YB)XA mod 97 = 4436 = 75 nod 97 K=(YA)XB mod 97 = 5058 = 75 nod 97
Example of D-H Key Exchange (2)
Hybrid Encryption Diffie-Hellman based hybrid encryption system A B YA K=(YB)xA =(YA)xB Mod q SK=h(K) YB ESK(M) 128 – 256 bits SK can be a key of the AES symmetric cryptosystem
The Man-in-the-Middle Attack (1)
The Man-in-the-Middle Attack (2)
The DH Problem and DL Problem (1)
The DH Problem and DL Problem (2) Example: a = loggh = log3 5 mod 19 = 4
Importance of Arbitrary Instances for Intractability Assumptions CRT a=kiqi+ai ri= g(p-1)/qi mod p riai=ria (mod qi) = h(p-1)/qi mod p
Chinese Remainder Theorem (1)
Chinese Remainder Theorem (2)
Chinese Remainder Theorem (3)
Example of CRT
ElGamal (1)
ElGamal (2)
Meet-in-the-middle attack & Active attack of ElGamal See Page 277 Example 8.8 Malice select Malice sends (c1, c2’=rc2) to Alice Alice returns rm to Malice