Docsity

Lecture Notes on Cryptography: Computational Number Theory and Prime Numbers, Study notes of Cryptography and System Security

Toggle sidebar
bg1
CS 120/ E-177: Introduction to Cryptography
Salil Vadhan and Alon Rosen Oct. 17, 2006
Lecture Notes 8:
Computational Number Theory
Recommended Reading.
•
Katz-Lindell 7, 8.1, 8.2, 8.4, 8.5
1 Sampling a Random Prime
Fact 1 (Prime Number Theorem)
#{
primes
≤x} ∼ x
ln x
as
x→ ∞
.
How do we sample a random
n
-bit prime number in time
poly(n)
?
2 Modular arithmetic:
ZN
and
Z∗
N
Basic denitions:
•x≡y(mod N)
if
N|(x−y)
.
•xmod Ndef
= [
unique
x0∈ {0, . . . , N −1}
s.t.
x≡x0(mod N)]
.
•ZN
def
={0, . . . , N −1}
with arithmetic (
+
,
·
) modulo
N
.
Fact 2 (Extended Euclidean Algorithm)
For any
x, y ∈N
there exists two integers
a
,
b
such
that
ax +by = gcd(x, y)
. Moreover, such
a
and
b
can be found in polynomial time.
1
pf3

Partial preview of the text

Download Lecture Notes on Cryptography: Computational Number Theory and Prime Numbers and more Study notes Cryptography and System Security in PDF only on Docsity!

CS 120/ E-177: Introduction to Cryptography

Salil Vadhan and Alon Rosen Oct. 17, 2006

Lecture Notes 8:

Computational Number Theory

Recommended Reading.

  • Katz-Lindell 7, 8.1, 8.2, 8.4, 8.

1 Sampling a Random Prime

Fact 1 (Prime Number Theorem) #{primes ≤ x} ∼ (^) lnx x as x → ∞.

How do we sample a random n-bit prime number in time poly(n)?

2 Modular arithmetic: ZN and Z∗ N

Basic denitions:

  • x ≡ y (mod N ) if N |(x − y).
  • x mod N def = [unique x′^ ∈ { 0 ,... , N − 1 } s.t. x ≡ x′^ (mod N )].
  • ZN def = { 0 ,... , N − 1 } with arithmetic (+,·) modulo N.

Fact 2 (Extended Euclidean Algorithm) For any x, y ∈ N there exists two integers a, b such that ax + by = gcd(x, y). Moreover, such a and b can be found in polynomial time.

Denition of Z∗ N

Z∗ N def = {x ∈ ZN : gcd(x, N ) = 1} = elements of ZN with multiplicative inverses

By a multiplicative inverse for x we mean an element y ∈ ZN , denoted y = x−^1 , such that x · y ≡ 1 (mod N ). (the equality is proved using the Extended Euclidean Algorithm). Given N and x ∈ ZN , we can compute x−^1 in polynomial time.

Euler phi function

φ(N ) def = |Z N∗ |

Fact 3 φ(N ) = N ·

primes p|N

p

N

6loglogN

This lower bound means that we can generate random elements from Z∗ N in time poly(|N |) = poly(n): we pick a random element in ZN and compute its gcd with N. If the gcd is equal to 1 then we have found an element of Z∗ N. The probability of success is φ( NN )so the expected number of trials is Θ

N φ(N )

= O(loglogN ) = O(log ||N ||). Computing φ(N ) from N is as hard as factoring.

Groups

  • A group G is a set G with binary operation? satisfying associativity, identity, inverses. All ours will also be commutative.
  • Examples: ZN under addition, Z∗ N under multiplication.
  • Fact: In any group G, x? x ?︸ ︷︷ · · ·? x︸ |G|

= id for all x ∈ G.

Corollary : ∀x ∈ Z∗ N , xφ(N^ )^ ≡ 1 (mod N )

Facts about Zp when p prime

  • Z∗ p = Zp \ { 0 } (because φ(p) = p − 1 ) and Zp is a eld.
  • Fermat's Little Theorem: For every a ∈ Z∗ p, ap−^1 ≡ 1 (mod p).
  • A polynomial of degree d has at most d solutions mod p.
  • For every prime p, there is a g ∈ Z∗ p such that {1 mod p, g mod p, g^2 mod p, g^3 mod p,... , gp−^2 mod p} = Z∗ p. Such a g is called a generator of Z∗ p.
  • Discrete logarithm: For x ∈ Z∗ p, logg x def = [unique i ∈ { 0 ,... , p − 2 } s.t. gi^ ≡ x (mod p)]. Computing the discrete logarithm is believed to be hard, even if p and g are known.
  • Fact 4 We can generate random n-bit prime p together with a (random) generator of Z∗ p time poly(n).