This section describes the algorithm used to compute discrete logarithms modulo p, where p is the prime used in the Sun NFS cryptosystem. A more detailed description is contained in [12].
All of the fast algorithms known for computing discrete logarithms are forms of the index-calculus algorithm [34]. In the index-calculus algorithm, an initial processing stage computes the discrete logarithms of a set Q of elements in the field. Once this table of logarithms has been computed, any other logarithm may be found relatively quickly utilizing the information in the table.
The basic idea behind the precomputation is to obtain a number of equations in the logarithms of elements of Q, and solve the resulting system modulo the prime factors of p-1. There are many techniques for obtaining the equations. We will discuss three of them: the linear sieve, the residue list sieve, and Gaussian integers. They were all shown in [12] to have the asymptotic running time given by Equation 2.
The first equation generating method is the linear sieve. Let
.
Let Q be the factor
base, consisting of the ``small primes,'' -1, and the set of integers
around H. We will search for pairs of integers (c1,c2) such that
in
We use a linear sieve to search for (c1,c2) pairs for which
(H+c1)(H+c2) is smooth with respect to the small primes in Q. Fix
c1, and let C be an array whose indexes are c2 values we wish to
consider. For each prime power qh with
and hsufficiently small, compute
The linear sieve suffers from two main problem. First, the factor base
Q is large, since it contains all the H+cj in addition to the small
primes qi, and thus we must collect many equations so that the
resulting system can be solved. In fact, as pointed out in
[24], we would really like to have many more equations than
unknowns in order to simplify the task of solving the system. The
second problem concerns the computation of d in
Equation 7. In a test implementation of the linear sieve,
we found that the time it took to invert (H+c1) and calculate d for
each prime qh was greater than the time it took to step through the
entire array C! (Notice also that since d depends on c1 and
qh, it is impossible to precompute d values.) These two problems
make the linear sieve undesirable for large values of p. However,
these deficiencies are not very serious, at least for
,
and the linear sieve would have been only slightly less
efficient than the method that we did implement for attacking the Sun
system. In general, the linear sieve has the advantage that it produces
sparser equations than the scheme that we actually used.
The second method of equation generation mentioned in [12] is the residue list sieve. We did not even consider implementing it, since it has huge space requirements and is slow.
The third method of equation generation, and the one which was
ultimately used, is the method of Gaussian integers [12],
which was inspired by the work of ElGamal [16]. The idea here
is to map the field GF(p) to a subset of
.
Let r be a
small negative integer which is also a quadratic residue modulo p, let
S be an integer such that
,
and let srepresent the imaginary number
.
Choose two integers
such that
.
Let the
factor base Q consist of small complex primes x+ys in Z[s], small
real primes q (some of which will factor into two complex primes), and the
integer V. Now, let p' = T+Vs, and choose
g = e + fs to be a complex
prime which generates
(Z[s]/p')*. This g is the new base for
logarithms.
In order to generate logarithm equations, we search for pairs of
integers (c1,c2) such that their residue c1V-c2T is smooth with
respect to the real primes q in the factor base Q. Notice that we may
write
We again use a sieve to find pairs of integers (c1,c2) whose
residues c1V-c2T are smooth over the small real primes in Q. For
a fixed value of c1, we allocate an array C corresponding to
possible values of c2. For each real prime power qh, compute
Notice that the Gaussian integer method avoids both of the major
problems associated with the linear sieve. Our factor base is not
unreasonably large, since it consists of only the small real and complex
primes, plus the integer V. Also, while it is true that we need to
calculate the value of
for every value
of c1 and qh, we can precompute the values of
.
Then on every sieve we only need multiply the stored value by c1modulo qh. In addition, for our specific p, we were able to
avoid performing any multiprecision arithmetic when calculating
values of d by appropriately choosing Q and the range of possible
c2 values.