2009 F
2009 F
Pollard’s p − 1 Method
a = 2
for (i = 2 to B) {
a = a^i mod n
if ( ( g = gcd(a - 1, n) ) > 1) {
print "g divides n"
stop
}
}
print "fail"
1
Note that at the end of the i-th iteration of
the loop we have a ≡ 2i! (mod n), so a ≡
2i! (mod p) if p divides n.
3
The quadratic sieve algorithm tries to factor n
simply by finding x and y with x2 ≡ y 2 (mod n),
ignoring the conditions x 6≡ ±y (mod n). (It
just hopes for the best. Usually, it finds several
such pairs x, y. Each pair succeeds in factoring
n with probability at least 1/2.)
4
Definition. An integer k is a square if there
exists an integer x so that k = x2.
a. 21
b. 23
c. 25
d. 27
e. 29
5
Which of these numbers is a square?
a. 431641
b. 431643
c. 431645
d. 431647
e. 431649
This is harder.
6
Suppose I give you the prime factorizations of
the numbers.
a. 431641 = 72 · 23 · 383
b. 431643 = 3 · 143881
c. 431645 = 5 · 131 · 659
d. 431647 = 17 · 25391
e. 431649 = 34 · 732
Qk e
Theorem. If n = i=1 pi i is the prime
factorization of n into the product of powers
of distinct primes, then n is square if and only
if all exponents ei are even numbers.
7
The quadratic sieve factoring algorithm finds
congruences x2 ≡ y 2 (mod n) as follows.
8
Example. Let us factor n = 1649. Note
√
that n ≈ 40.6, so the numbers 412 mod n,
422 mod n, . . ., will be fairly small compared
to n. We have
9
In a real application of the quadratic sieve there
may be millions of relations j 2 ≡ m (mod n)
with m factored. How can we efficiently match
the prime factors of the ms to make each prime
occur an even number of times?
Qb e
If m = i=1 pi i , where each exponent ei ≥ 0,
associate m to the vector
coordinates.
10
Reduce the exponent vectors v(m) modulo 2
and think of them as vectors in the b-dimensional
vector space Fb2 over F2 = {0, 1}.
√
Thus,
√ e (ln n)(ln ln n) ≤ nε for any ε > 0 and
e (ln n)(ln ln n) ≥ (ln n)c for any constant c > 0.
That is, the time complexity is subexponential
but not polynomial time.
12
Discrete Logarithms via Index Calculus
13
Choose a factor base of primes p1, . . . , pk , usu-
ally all primes ≤ B. Perform the following pre-
computation which depends on a and p but
not on b. For many random values of x, try to
factor ax mod p using the primes in the factor
base.
14
Use linear algebra to solve for the Logapi.
Write it as
k
c
bas ≡
Y
pi i (mod p)
i=1
or
k
X
(Logab) + s ≡ ciLogapi (mod p − 1).
i=1
Substitute the values of Logapi found in the
precomputation to get Logab.
15
Using arguments like those for the running time
of the quadratic sieve factoring algorithms, one
can prove that the precomputation takes time
q
exp 2 log p log log p ,
16