ch15
ch15
This is a chapter from version 2.0 of the book “Mathematics of Public Key Cryptography”
by Steven Galbraith, available from http://www.math.auckland.ac.nz/˜sgal018/crypto-
book/crypto-book.html The copyright for this chapter is held by Steven Galbraith.
This book was published by Cambridge University Press in early 2012. This is the
extended and corrected version. Some of the Theorem/Lemma/Exercise numbers may be
different in the published version.
Please send an email to [email protected] if you find any mistakes.
One of the most powerful tools in mathematics is linear algebra, and much of mathe-
matics is devoted to solving problems by reducing them to it. It is therefore natural to try
to solve the integer factorisation and discrete logarithm problems (DLP) in this way. This
chapter briefly describes a class of algorithms that exploit a notion called “smoothness”,
to reduce factoring or DLP to linear algebra. We present such algorithms for integer
factorisation, the DLP in the multiplicative group of a finite field, and the DLP in the
divisor class group of a curve.
It is beyond the scope of this book to give all the details of these algorithms. In-
stead, the aim is to sketch the basic ideas. We mainly present algorithms with nice
theoretical properties (though often still requiring heuristic assumptions) rather than the
algorithms with the best practical performance. We refer to Crandall and Pomerance
[162], Shoup [556] and Joux [317] for further reading.
The chapter is arranged as follows. First we present results on smooth integers, and
then sketch Dixon’s random squares factoring algorithm. Section 15.2.3 then summarises
the important features of all algorithms of this type. We then briefly describe a number
of algorithms for the discrete logarithm problem in various groups.
323
324 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
It is important for this chapter to have good bounds on Ψ(X, Y ). Let u = log(X)/ log(Y )
(as usual log denotes the natural logarithm), so that u > 1, Y = X 1/u and X = Y u .
There is a function ρ : R>0 → R>0 called the Dickman-de Bruijn function (for the
exact definition of this function see Section 1.4.5 of [162]) such that, for fixed u > 1,
Ψ(X, X 1/u ) ∼ Xρ(u), where f (X) ∼ g(X) means limX→∞ f (X)/g(X) = 1. A crude es-
timate for ρ(u), as u → ∞ is ρ(u) ≈ 1/uu . For further details and references see Section
1.4.5 of [162].
The following result of Canfield, Erdös and Pomerance [117] is the main tool in this
subject. This is a consequence of Theorem 3.1 (and the corollary on page 15) of [117].
Corollary 15.1.3. Let the notation be as in Theorem 15.1.2. Then Ψ(N, N 1/u ) =
N u−u+o(u) = N u−u(1+o(1)) uniformly as u → ∞ and u ≤ (1 − ǫ) log(N )/ log(log(N ))
(and hence also N → ∞).
Definition 15.1.5. Let 0 ≤ a ≤ 1 and c ∈ R>0 . The subexponential function for the
parameters a and c is
Note that taking a = 0 gives LN (0, c) = log(N )c (polynomial) while taking a = 1 gives
LN (1, c) = N c (exponential). Hence LN (a, c) interpolates exponential and polynomial
growth. A complexity O(LN (a, c)) with 0 < a < 1 is called subexponential.
3.
O(LN (a1 , c1 )) if a1 > a2 ,
LN (a1 , c1 ) + LN (a2 , c2 ) = O(LN (a1 , max{c1 , c2 } + o(1))) if a1 = a2 ,
O(LN (a2 , c2 )) if a2 > a1 .
15.2. FACTORING USING RANDOM SQUARES 325
4. Let 0 < b < 1 and 0 < d. If M = LN (a, c) then LM (b, d) = LN (ab, dcb a1−b + o(1))
as N → ∞.
5. log(N )m = O(LN (a, c)) for any m ∈ N.
6. LN (a, c) log(N )m = O(LN (a, c + o(1))) as N → ∞ for any m ∈ N. Hence, one can
always replace Õ(LN (a, c)) by O(LN (a, c + o(1))).
7. log(N )m ≤ LN (a, o(1)) as N → ∞ for any m ∈ N.
8. If F (N ) = O(LN (a, c)) then F (N ) = LN (a, c + o(1)) as N → ∞.
√
9. LN (1/2, c) = N c log(log(N ))/ log(N ) .
Exercise 15.1.7. Prove Lemma 15.1.6.
Corollary 15.1.8. Let c > 0. As N → ∞, the probability that a randomly chosen integer
1 ≤ x ≤ N is LN (1/2, c)-smooth is LN (1/2, −1/(2c) + o(1)).
Exercise 15.1.9. Prove Corollary 15.1.8 (using Corollary 15.1.3).
Exercise 15.1.10. Let 0 < b < a < 1. Let 1 ≤ x ≤ LN (a, c) be a randomly chosen
integer. Show that the probability that x is LN (b, d)-smooth is LN (a−b, −c(a−b)/d+o(1))
as N → ∞.
The values x for which a relation is found are stored as x1 , x2 , . . . , xt . The corresponding
exponent vectors ej = (ej,1 , . . . , ej,s ) for 1 ≤ j ≤ t are also stored. When enough relations
have been found we can use linear algebra modulo 2 to obtain congruent squares. More
precisely, compute λj ∈ {0, 1} such that not all λj = 0 and
t
X
λj ej ≡ (0, 0, . . . , 0) (mod 2).
j=1
One then has X 2 ≡ Y 2 (mod N ) and one can hope to split N by computing gcd(X −Y, N )
(note that this gcd could be 1 or N , in which case the algorithm has failed). We present
the above method as Algorithm 22.
We emphasise that the random squares algorithm has two distinct stages. The first
stage is to generate enough relations. The second stage is to perform linear algebra.
The first stage can easily be distributed or parallelised, while the second stage is hard to
parallelise.
Example 15.2.2. Let N = 19 · 29 = 551 and let B = {2, 3, 5}. One finds the following
congruences (in general 4 relations would be required, but we are lucky in this case)
342 ≡ 2 · 33 (mod N )
522 ≡ 22 · 53 (mod N )
552 ≡ 2 · 33 · 5 (mod N ).
15.2. FACTORING USING RANDOM SQUARES 327
Exercise 15.2.5. Show that if one takes s + l relations where l ≥ 2 then the probability
of splitting N is at least 1 − 1/2l .
We now consider the probability of smoothness. We first assume the probability that
x2 (mod N ) is smooth is the same as the probability that a random integer modulo N is
smooth.3
Lemma 15.2.6. Let the notation be as above. Let TB be the expected number of trials
until a randomly chosen integer modulo N is B-smooth. Assuming that squares modulo N
are as likely to be smooth as random integers of the same size, Algorithm 22 has expected
running time at most
c1 #B 2 TB M (log(N )) + c2 (#B)3
bit operations for some constants c1 , c2 (where M (n) is the cost of multiplying two n-bit
integers).
This implies log(B)2 ≈ log(N ) log(log(N )) and so B ≈ LN (1/2, 1). The overall complex-
ity for this choice of B would be LN (1/2, 3 + o(1)) bit operations.
A more careful argument is to set B = LN (1/2, c) and use Corollary 15.1.3. It fol-
lows that TB = LN (1/2, 1/(2c) + o(1)) as N → ∞. Putting this into the equation of
Lemma 15.2.6 gives complexity LN (1/2, 2c + 1/(2c) + o(1)) + LN (1/2, 3c) bit operations.
The function x + 1/x is minimised at x = 1, hence we should take c = 1/2.
Theorem 15.2.7. Let the notation be as above. Under the same assumptions as Lemma 15.2.6
then Algorithm 22 has complexity
LN (1/2, 2 + o(1))
bit operations as N → ∞.
3 Section 16.3 of Shoup [556] gives a modification of the random squares algorithm for which one can
avoid this assumption. The trick is to note that at least one of the cosets of (Z/N Z)∗ /((Z/N Z)∗ )2 has
at least as great a proportion of smooth numbers as random integers up to N (Shoup credits Rackoff
for this trick). The idea is to work in one of these cosets by choosing at random some 1 < δ < N and
considering relations coming from smooth values of δx2 (mod N ).
15.2. FACTORING USING RANDOM SQUARES 329
x x2 (mod N ) e
43 −26 · 3 (1, 6, 1, 0 )
44 Not 5-smooth
45 −24 ( 1, 4, 0, 0 )
46 3 · 52 ( 0, 0, 1, 2 )
15.2.3 Summary
We briefly highlight the key ideas in the algorithms of this section. The crucial concept
of smooth elements of the group (Z/N Z)∗ arises from considering an integer modulo N
as an element of Z. The three essential properties of smooth numbers that were used in
the algorithm are:
1. One can efficiently decompose an element of the group as a product of smooth
elements, or determine that the element is not smooth.
2. The probability that a random element is smooth is sufficiently high.
3. There is a way to apply linear algebra to the relations obtained from smooth ele-
ments to solve the computational problem.
We will see analogues of these properties in the algorithms below.
There are other general techniques that can be applied in most algorithms of this
type. For example, the linear algebra problems are usually sparse and so the matrices
and algorithms should be customised for this. Another general concept is “large prime
variation” which, in a nutshell, is to also store “nearly smooth” relations (i.e., elements
that are the product of a smooth element with one or two prime elements that are not
too large) and perform some elimination of these “large primes” before doing the main
linear algebra stage (this is similar to, but more efficient than, taking a larger factor base).
Finally we remark that the first stage of these algorithms (i.e., collecting relations) can
always be distributed or parallelised.
The elliptic curve method (ECM) works well in practice but, as with the Pollard
p − 1 method, its complexity depends on the size of the smallest prime dividing N .
It is not a polynomial-time algorithm because, for any constant c > 0 and over all N
and p | N , a randomly chosen elliptic curve over Fp is not likely to have O(log(N )c )-
smooth order. As we have seen, the theorem of Canfield, Erdös and Pomerance [117] says
it is more reasonable to hope that integers have a subexponential probability of being
subexponentially smooth. Hence, one might hope that the elliptic curve method has
subexponential complexity. Indeed, Lenstra [377] makes the following conjecture (which
is essentially that the Canfield-Erdös-Pomerance result holds in small intervals).
Conjecture 15.3.1. (Lenstra [377], page 670) √ The probability
√ that an integer, cho-
sen uniformly at random in the range (X − X, X + X), is LX (1/2, c)-smooth is
LX (1/2, −1/(2c) + o(1)) as X tends to infinity.5
One can phrase Conjecture 15.3.1 as saying that, if√ps is the probability that
√ a random
integer between 1 and X is Y -smooth, then Ψ(X + 2 X, Y ) − Ψ(X, Y ) ≈ 2 Xps . More
generally, one would like to know that, for sufficiently large6 X, Y and Z,
or, in other words, that integers in a short interval at X are about as likely to be Y -smooth
as integers in a large interval at X.
We now briefly summarise some results in this area; see Granville [267] for details and
references. Harman (improved by Lenstra, Pila and Pomerance [380]) showed, for any
fixed β > 1/2 and X ≥ Y ≥ exp(log(X)2/3+o(1) ), where the o(1) is as X → ∞, that
Obtaining√ results for the required value β = 1/2 seems to be hard and the experts refer
to the “ X barrier” for smooth integers in short intervals. It is known that this barrier
can be broken most of the time: Hildebrand and Tenenbaum showed that, for any ǫ > 0,
equation (15.5) holds when X ≥ Y ≥ exp(log(X)5/6+ǫ ) and Y exp(log(X)1/6 ) ≤ Z ≤ X
for all but at most M/ exp(log(M )1/6−ǫ ) integers 1 ≤ X ≤ M . As a special case, this
√ √
result shows that, for almost all primes p, the interval [p− p, p+ p] contains a Y -smooth
integer where Y = exp(log(X)5/6+ǫ ) (i.e., subexponential smoothness).
Using Conjecture 15.3.1 one obtains the following complexity for the elliptic curve
method (we stress that the complexity is in terms of the smallest prime factor p of N ,
rather than N itself).
Theorem 15.3.2. (Conjecture 2.10 of [377]) Assume √ Conjecture 15.3.1. One can find
the smallest factor p of an integer N in Lp (1/2, 2 + o(1))M (log(N )) bit operations as
p → ∞.
√
Proof: Guess the size of p and choose B = Lp (1/2, 1/ 2) (since the size of p is not known
one actually runs the algorithm repeatedly for slowly increasing values
√ of B). Then each
run of Algorithm 12 requires O(B log(B)M (log(N ))) = Lp (1/2, 1/ 2 + o(1))M √(log(N ))
bit operations. By Conjecture 15.3.1 one needs to repeat the process Lp (1/2, 1/ 2+ o(1))
times. The result follows.
5 Lenstra
√ √ √ √
considers the sub-interval (X − X, X + X) of the Hasse interval [X +1−2 X, X +1+2 X]
because the distribution of isomorphism classes of randomly chosen elliptic curves is relatively close to
uniform when restricted to those whose group order lies in this sub-interval. In contrast, elliptic curves
whose group orders are near the edge of the Hasse interval arise with lower probability.
6 The notation ∼ means taking a limit as X → ∞, so it is necessary that Y and Z grow in a controlled
way as X does.
332 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
√
Exercise√ 15.3.3. Let N = pq where p is prime and p < N < 2p. Show that
Lp (1/2, 2 + o(1)) = LN (1/2, 1 + o(1)). Hence, in the worst case, the complexity of
ECM is the same as the complexity of the quadratic sieve.
For further details on the elliptic curve method we refer to Section 7.4 of [162]. We
remark that Lenstra, Pila and Pomerance [380] have considered a variant of the elliptic
curve method using divisor class groups of hyperelliptic curves of genus 2. The Hasse-Weil
interval for such curves contains an interval of the form (X, X + X 3/4 ) and Theorem 1.3
of [380] proves that such intervals contain LX (2/3, c1 )-smooth integers (for some constant
c1 ) with probability 1/LX (1/3, 1). It follows that there is a rigorous factoring algorithm
with complexity Lp (2/3, c) bit operations for some constant c2 . This algorithm is not
used in practice, as the elliptic curve method works fine already.
Exercise 15.3.4. Suppose a sequence of values 1 < x < N are chosen uniformly at
random. Show that one can find such a value that is LN (2/3, c)-smooth, together with
its factorisation, in expected LN (1/3, c′ + o(1)) bit operations for some constant c′ .
Remark 15.3.5. It is tempting to conjecture that the Hasse interval contains a polynomially-
smooth integer (indeed, this has been done by Maurer and Wolf [407]; see equation (21.9)).
This is not relevant for the elliptic curve factoring method, since such integers would
be very rare. Suppose the probability that an integer of size X is Y -smooth is ex-
actly 1/uu , where u = log(X)/ log(Y ) (by Theorem 15.1.2, this √ is reasonable
√ as long as
Y 1−ǫ ≥ log(X)). It is natural to suppose
√ that the interval [X − 2 X, X + 2 X] is likely
to contain a Y -smooth integer if 4 X > uu . Let Y = log(X)c . Taking logs of both sides
of the inequality gives the condition
1 log(X)
log(4) + 2 log(X) > (log(log(X)) − log(c log(log(X)))).
c log(log(X))
It is therefore natural to conclude that when c ≥ 2 there is a good chance that the Hasse
interval of an elliptic curve over Fp contains a log(p)c -smooth integer. Proving such a
claim seems to be far beyond the reach of current techniques.
algorithm in the case of numbers of a special form is known as the special number field sieve.
15.4. THE NUMBER FIELD SIEVE 333
with running time O(LN (1/3, c+o(1))) bit operations, for some constant c, by considering
smaller values for smoothness.
It seems to be impossible to directly choose values x such that x2 (mod N ) is of size
LN (2/3, c + o(1)) for some constant c. Hence, the number field sieve relies on two factor
bases B1 and B2 . Using smooth elements over B1 (respectively, B2 ) and linear algebra one
finds an integer square u2 and an algebraic integer square v 2 . The construction allows us
to associate an integer w modulo N to v such that u2 ≡ w2 (mod N ) and hence one can
try to split N .
We briefly outline the ideas behind the algorithm. First, choose a monic irreducible
polynomial P (x) ∈ Z[x] of degree d (where d grows like ⌊(3 log(N )/ log(log(N )))1/3 ⌋)
with a root m = ⌊N 1/d ⌋ modulo N (i.e., P (m) ≡ 0 (mod N )). Factor base B1 is primes
up to B = LN (1/3, c) and factor base B2 is small prime ideals in the ring Z[θ] in the
number field K = Q(θ) = Q[x]/(P (x)) (i.e., θ is a generic root of P (x)). The algorithm
exploits, in the final step, the ring homomorphism φ : Z[x]/(P (x)) → Z/N Z given by
φ(θ) = m (mod N ). Suppose the ideal (a − bθ) is a product of prime ideals in B2 (one
factors the ideal (a − bθ) by factoring its norm in Z), say
r
Y
(a − bθ) = ℘ei i .
i=1
If these equations hold then we call (a − bθ) and a − bm smooth and store a, b and the
sequences of ei and fj . We do not call this a “relation” as there is no direct relationship
between the prime ideals ℘i and the primes pj . Indeed, the ℘j are typically non-principal
ideals and do not necessarily contain an element of small norm. Hence, the two products
are modelled as being “independent”.
It is important to estimate the probability that both the ideal (a − bθ) and the integer
a−bm are smooth. One shows that taking integers |a|, |b| ≤ LN (1/3, c′ +o(1)) for a suitable
constant c′ gives (a − bθ) of norm LN (2/3, c′′ + o(1)) and a − bm of size LN (2/3, c′′′ + o(1))
for certain constants c′′ and c′′′ . To obtain a fast algorithm one uses sieving to determine
within a range of values for a and b the pairs (a, b) such that both a − bm and (a − bθ)
factor over the appropriate factor base.
Performing linear algebra on both sides gives a set S of pairs (a, b) such that (ignoring
issues with units and non-principal ideals)
Y
(a − bm) = u2
(a,b)∈S
Y
(a − bθ) = v 2
(a,b)∈S
for some u ∈ Z and v ∈ Z[θ]. Finally we can “link” the two factor bases: Applying the
ring homomorphism φ : Z[θ] → Z gives u2 ≡ φ(v)2 (mod N ) and hence we have a chance
to split N . A non-trivial task is computing the actual numbers u and φ(v) modulo N so
that one can compute gcd(u − φ(v), N ).
Since one is only considering integers a − bm in a certain range (and ideals in a certain
range) for smoothness one relies on heuristic assumptions about the smoothness prob-
ability. The conjectural complexity of the number field sieve is O(LN (1/3, c + o(1)))
334 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
g Z1 hZ2 = 1 (15.6)
in F∗q then logg (h) = −Z1 Z2−1 (mod r). The idea will be to find such a relation using
a factor base and linear algebra. Such algorithms go under the general name of index
calculus algorithms; the reason for this is that index is another word for discrete loga-
rithm, and the construction of a solution to equation (15.6) is done by calculations using
indices.
The values zi are stored in a vector and the values ei = (ei,1 , . . . , ei,s ) are stored as a row
in a matrix. We need s relations of this form. We also need at least one relation involving
h (alternatively, we could have used a power of h in every relation in equation (15.7))
so try random values zs+1 and δs+1 ∈ G′ until g zs+1 hδs+1 (mod p) is B-smooth. One
performs linear algebra modulo r to find integers 0 ≤ λ1 , . . . , λs+1 < r such that
s+1
X
λi ei = (rf1 , . . . , rfs ) ≡ (0, . . . , 0) (mod r)
i=1
Exercise 15.5.3. Show that if one replaces equation (15.7) by g z1,i hz2,i δi for random
z1,i , z2,i and δi then one obtains an algorithm that succeeds with probability 1 − 1/r.
Example 15.5.4. Let p = 223. Then g = 15 has prime order r = 37. Suppose h = 68
is the instance of the DLP we want to solve. Let B = {2, 3, 5, 7}. Choose the element
g1 = 184 of order (p − 1)/r = 6. One can check that we have the following relations.
Now perform linear algebra modulo 37. One finds the non-trivial kernel vector v =
(1, 36, 20, 17, 8). Computing Z1 = v · z = 7 (mod 37) and Z2 = 8 we find g Z1 hZ2 ≡
1 (mod 223) and so the solution is −Z1 Z2−1 ≡ 13 (mod 37).
Exercise 15.5.5. Write the above algorithm in pseudocode (using trial division to de-
termine the smooth relations).
336 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
Exercise 15.5.6. Let the notation be as above. Let TB be the expected number of trials
of random integers modulo p until one is B-smooth. Show that the expected running
time of this algorithm (using naive trial division for the relations and using the Lanczos
or Wiedemann methods for the linear algebra) is
bit operations as p → ∞
Exercise 15.5.7. Show that taking B = Lp (1/2, 1/2) is the optimal value to minimise
the complexity of the above algorithm, giving a complexity of O(Lp (1/2, 2 + o(1))) bit
operations for the discrete logarithm problem in F∗p as p → ∞. (Note that, unlike many
of the results in this chapter, this result does not rely on any heuristics.)
We remark that, in practice, rather than computing a full exponentiation g z one might
use a pseudorandom walk as done in Pollard rho. For further implementation tricks see
Sections 5.1 to 5.5 of Odlyzko [469].
If g does not have prime order (e.g., suppose g is a generator of F∗p and has order p − 1)
then there are several options: One can apply Pohlig-Hellman and reduce to subgroups
of prime order and apply index calculus in each subgroup (or at least the ones of large
order). Alternatively, one can apply the algorithm as above and perform the linear algebra
modulo the order of g. There will usually be difficulties with non-invertible elements in
the linear algebra, and there are several solutions, such as computing the Hermite normal
form of the relation matrix or using the Chinese remainder theorem, we refer to Section
5.5.2 of Cohen [136] and Section 15.2.1 of Joux [317] for details.
Exercise 15.5.8. Give an algorithm similar to the above that works when r2 | (p − 1).
Exercise 15.5.9. This exercise is about solving many different discrete logarithm in-
stances hi = g ai (mod p), for 1 ≤ i ≤ n, to the same base g. Once sufficiently many
relations are found, determine the cost of solving each individual instance of the DLP.
Hence show that one can solve any constant number of instances of the DLP to a given
base g ∈ F∗p in O(Lp (1/2, 2 + o(1))) bit operations as p → ∞.
Exercise 15.5.10. (Blake, Fuji-Hara, Mullin and Vanstone [61]) Once one has computed
w = g z δ (mod p) one can apply the Euclidean algorithm to find integers w1 , w2 such that
√
w1 w ≡ w2 (mod p) and w1 , w2 ≈ p. Since w1 and w2 are smaller one would hope
that they are much more likely to both be smooth (however, note that both must be
smooth). We now make the heuristic assumption that the probability each wi is B-
√
smooth is independent and the same as the probability that any integer of size p is
B-smooth. Show that the heuristic running time of the algorithm has uu replaced by
(u/2)u (where u = log(p)/ log(B)) and so the asymptotic running time remains the same.
15.5. INDEX CALCULUS IN FINITE FIELDS 337
Coppersmith, Odlyzko and Schroeppel [145] proposed an algorithm for the DLP in F∗p
√
that uses sieving. Their idea is to let H = ⌈ p⌉ and define the factor base to be
B = {q : q prime, q < Lp (1/2, 1/2)} ∪ {H + c : 1 ≤ c ≤ Lp (1/2, 1/2 + ǫ)}.
Since H 2 (mod p) is of size ≈ p1/2 it follows that if (H + c1 ), (H + c2 ) ∈ B then (H +
c1 )(H +c2 ) (mod p) is of size p1/2+o(1) . One can therefore generate relations in B. Further,
it is shown in Section 4 of [145] how to sieve over the choices for c1 and c2 . A heuristic
analysis of the algorithm gives complexity Lp (1/2, 1 + o(1)) bit operations.
The number field sieve (NFS) is an algorithm for the DLP in F∗p with heuristic
complexity O(Lp (1/3, c + o(1))) bit operations. It is closely related to the number field
sieve for factoring and requires algebraic number theory. As with the factoring algorithm,
there are two factor bases. Introducing the DLP instance requires an extra algorithm (we
will see an example of this in Section 15.5.4). We do not have space to give the details
and instead refer to Schirokauer, Weber and Denny [519] or Schirokauer [515, 517] for
details.
The algorithm then follows exactly the ideas of the previous section. Suppose g has
prime order r | (pn − 1) and h ∈ hgi. The factor base is
for some integer b to be determined later. Note that #B = I(1) + I(2) + · · · + I(b) ≈
pb+1 /(b(p − 1)) (see Exercise 15.5.14). We compute random powers of g multiplied by a
suitable δ ∈ G′ (where, if r2 ∤ (pn − 1), G′ ⊆ F∗pn is the subgroup of order (pn − 1)/r;
when r2 | (pn − 1) then use the method of Exercise 15.5.8), reduce to polynomials in
Fp [x] of degree at most n, and try to factor them into products of polynomials from B.
By Exercise 2.12.11 the cost of factoring the b-smooth part of a polynomial of degree n
is O(bn log(n) log(p)M (log(p))) = O(log(pn )3 ) bit operations (in any case, polynomial-
time). As previously, we are generating polynomials of degree n uniformly at random
and so, by Theorem 15.5.12, the expected number of trials to get a relation is uu(1+o(1))
where u = n/b as u → ∞. We need Q to obtain #B relations in general. Then we obtain
a single relation of the form hg a δ = P ∈B P eP , perform linear algebra, and hence solve
the DLP.
Exercise 15.5.13. Write the above algorithm in pseudocode.
Pb
Exercise 15.5.14. Show that i=1 I(b) ≤ 1b pb (1 + 2/(p − 1)) + O(bpb/2 ). Show that a
very rough approximation is pb+1 /(b(p − 1)).
Exercise 15.5.15. Let the notation be as above. Show that the complexity of this
algorithm is at most
The “systematic equations” of Blake et al are relations among elements of the factor
base that come almost for free. For example, in F2127 , if A(x) ∈ F2 [x] is an irreducible
polynomial in the factor base then A(x)128 = A(x128 ) ≡ A(x2 + x) (mod F (x)) and
A(x2 + x) is either irreducible or is a product P (x)P (x + 1) of irreducible polynomials of
the same degree (Exercise 15.5.18). Hence, for many polynomials A(x) in the factor base
one gets a non-trivial relation.
Exercise 15.5.18. Let A(x) ∈ F2 [x] be an irreducible polynomial. Show that A(x2 + x)
is either irreducible or a product of two polynomials of the same degree.
Coppersmith [140] extended the idea as follows: Let b ∈ N be such that b = cn1/3 log(n)2/3
2/3
for a suitable
p constant c (later we take c = (2/(3 log(2))) √ ), let√ k ∈ N be such that
1
2 ≈ n/b ≈ c (n/ log(n)) , and let l = ⌈n/2 ⌉ ≈ nb ≈ cn2/3 log(n)1/3 . Let
k √ 1/3 k
Write D(x) for the right hand side of equation (15.9). We have deg(C(x)) ≤ max{dA +
l, dB } ≈ l ≈ n2/3 log(n)1/3 and deg(D(x)) ≤ max{2k dA + (2k l − n) + deg(F1 (x)), 2k dB } ≈
2k b ≈ n2/3 log(n)1/3 .
We have two polynomials C(x), D(x) of degree ≈ n2/3 that we wish to be b-smooth
where b ≈ n1/3 log(n)2/3 . We will sketch the complexity later under the heuristic as-
sumption that, from the point of view of smoothness, these polynomials are independent.
We will also assume that the resulting relations are essentially random (and so with
high probability there is a non-trivial linear dependence once #B + 1 relations have been
collected).
Having generated enough relations among elements of the factor base, it is necessary
to find some relations involving the elements g and h of the DLP instance. This is not
trivial. All DLP algorithms having complexity Lq (1/3, c + o(1)) feature a process called
special q-descent
Q that achieves this. The first step is to express g (respectively, h) as a
product i Gi (x) of polynomials of degree at most b1 = n2/3 log(n)1/3 ; this can be done
by multiplying g (resp. h) by random combinations of elements of B and factoring (one
can also apply the Blake et al trick as in Exercise 15.5.10). We now have a list of around
2n1/3 < n polynomials Gi (x) of degree ≈ n2/3 that need to be “smoothed” further.
Section VII of [140] gives a method to do this: essentially one performs the same sieving
as earlier except that A(x) and B(x) are chosen so that Gi (x) | C(x) = A(x)xl + B(x)
(not necessarily with the same value of l or the same degrees for A(x) and B(x)). Defining
k
D(x) = C(x)2 (mod F (x)) (not necessarily the same value of k as before) one hopes that
C(x)/G(x) and D(x) are b-smooth. After sufficiently many trials one has a relation that
expresses Gi (x) in terms of elements of B. Repeating for the polynomially many values
Gi (x) one eventually has the values g and h expressed in terms of elements of B. One can
then do linear algebra modulo the order of g to find integers Z1 , Z2 such that g Z1 hZ2 = 1
and the DLP is solved.
340 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
Example 15.5.20. We give an example of Coppersmith’s method for F215 = F2 [x]/(F (x))
where F (x) = x15 + x + 1. We consider the subgroup of F∗215 of order r = 151 (note that
(215 − 1)/r = 7 · 31 = 217). Let g = x11 + x7 + x5 + x2 + 1 and h = x14 + x11 + x10 + x9 + 1
be the DLP instance.
First note that n1/3 ≈ 2.5 and n2/3 ≈ 6.1. We choose b = 3 and so B = {x, x + 1, x2 +
x + 1, x3 + x + 1, x3 + x2 + 1}. We hope to be testing polynomials of degree around 6 to
8 for smoothness.
First, we find some “systematic equations”. We obviously have the relation x15 = x+1.
We also have (x + 1)16 = x2 + x + 1 and (x3 + x + 1)16 = (x3 + xp + 1)(x3 +√x2 + 1).
k
Now, we do Coppersmith’s method. We must choose 2 ≈ n/b = 5 ≈ 2.2 so
take 2k = 2. Let l = ⌈n/2k ⌉ = 8, choose A(x) and B(x) of degree at most 2, set
C(x) = A(x)x8 + B(x) and D(x) = C(x)2 (mod F (x)), and test C(x) and D(x) for
smoothness over B. We find the following pairs (A(x), B(x)) such that both C(x) and
D(x) factor over B.
To solve the DLP one can now try to express g and h over the factor base. One has
For h we find
hg 30 = x6 (x + 1)4 G(x)
where G(x) = x4 +x+1 is a “large prime”. To “smooth” G(x) we choose A(x) = 1, B(x) =
A(x)x8 (mod G(x)) = x2 + 1, C(x) = A(x)x8 + B(x) and D(x) = C(x)2 (mod F (x)).
One finds C(x) = G(x)2 and D(x) = (x + 1)(x3 + x2 + 1). In other words, G(x)4 =
(x + 1)(x3 + x2 + 1).
There are now two ways to proceed. Following the algorithm description above we add
to the matrix the two rows (1, 1, 2, 0, 1) and 4(6, 4, 0, 0, 0)+(0, 1, 0, 0, 0, 1) = (24, 17, 0, 0, 1)
corresponding to g 22 and h4 g 120 . Finding a non-trivial kernel vector modulo 151, such as
(1, 114, 0, 132, 113, 133, 56) gives the relation
and so
−1
(mod (215 −1))
g = x15841·22 = x26040 = (x217 )120 .
Similarly, G(x)4 = (x+ 1)(x3 + x2 + 1) = x15+15345 = x15360 and so G(x) = x3840 . Finally,
Note that, to compare with Exercise 15.2.12, if q = 21024 then Lq (1/3, (32/9)1/3) ≈
67
2 .
This conjecture would hold if the probability that the polynomials C(x) and D(x) are
smooth was the same as for independently random polynomials of the same degree. p We
now give a justification for √ the constant. Let b = cn1/3 log(n)2/3 . Note that 2k ≈ n/b ≈
√
(n/ log(n))1/3 / c and l ≈ nb. We need around 2b /b relations, and note that log(2b /b) ≈
b log(2) = c log(2)n1/3 log(n)2/3 . We have deg(C(x)) ≈ dA + l and deg(D(x)) ≈ k
p 2 dA .
u
The number of trials until C(x) is b-smooth is u where u = (dA + l)/b ≈ h/b ≈ n/b =
√1 (n/ log(n))1/3 . Hence, log(uu ) = u log(u) ≈ √ 1
n1/3 log(n)2/3 . Similarly, the number
c 3 c p
of trials until D(x) is b-smooth is approximately uu where u = (2k dA )/b ≈ 2k ≈ n/b
and the same argument applies. Since both events must occur the expected number of
2
trials to get a relation is exp( 3√ c
(n log(n)2 )1/3 ). Hence, total expected time to generate
enough relations is
2 1/3 2/3
exp (c log(2) + 3√ c
)n log(n) .
This is optimised when c3/2 log(2) = 2/3, which leads to the stated complexity for the
first stage of the algorithm. (In practice one chooses c so that there are enough smooth
pairs (C(x), D(x)) to generate the required number of relations.) The linear algebra is
O((2b /b)2+o(1) M (log(r))) bit operations, which is the same complexity, and the final stage
of solving the DLP has lower complexity (it is roughly the same as the cost of finding
polynomially many smooth relations, rather than finding 2b /b of them). For more details
about the complexity of Coppersmith’s method we refer to Section 2.4 of Thomé [608].
Since one can detect smoothness of polynomials in polynomial-time it is not necessary,
from a complexity theory point of view, to sieve. However, in practice sieving can be
worthwhile and a method to do this was given by Gordon and McCurley [263].
Coppersmith’s idea is a special case of a more general approach to index calculus
algorithms known as the function field sieve. Note that Coppersmith’s algorithm only
has one factor base, whereas the function field sieve works using two factor bases.
Given a prime p and an integer n one can find such polynomials F1 (t) and F2 (t) in very
little time (e.g., by choosing polynomials of the right degree uniformly at random and
testing the condition using polynomial factorisation).
Exercise 15.5.22. Let n = 15. Find polynomials F1 (t), F2 (t) ∈ F2 [t] of degree 4 such
that F2 (F1 (t)) − t has an irreducible factor of degree 15.
Now consider the polynomial ring A = Fp [x, y] and two ring homomorphisms ψ1 :
A → A1 = Fp [x] by ψ1 (y) = F1 (x) and ψ2 : A → A2 = Fp [y] by ψ2 (x) = F2 (y). Define
φ1 : A1 → Fpn by φ1 (x) = t (mod F (t)) and φ2 : A2 → Fpn by φ2 (y) = F1 (t) (mod F (t)).
Exercise 15.5.23. Let the notation be as above and G(x, y) ∈ Fp [x, y]. Show that
φ1 (ψ1 (G(x, y))) = φ2 (ψ2 (G(x, y))) in Fpn .
Let B1 ⊆ A1 = Fp [x] and B2 ⊆ Fp [y] be the sets of linear polynomials. The idea
of the algorithm is simply to consider polynomials in Fp [x, y] of the form G(x, y) =
Q
xy + ax + by + c. If ψ1 (G(x, y)) = (x + b)F1 (x) + (ax + c) factors over B1 as d+1
i=1 (x − ui )
Qd+1
and if ψ2 (G(x, y)) = (y + a)F2 (y) + (by + c) factors over B2 as j=1 (y − vj ) then we have
a relation. The point is that such a relation corresponds to
d+1
Y d+1
Y
(t − ui ) = (F1 (t) − vj )
i=1 j=1
in Fpn .
One also needs to introduce the DLP instance by using a special q-descent: given
an irreducible polynomial q(x) one constructs polynomials a(x), b(x) such that q(x) |
(a(x)F1 (x) + b(x)) and one hopes that (a(x)F1 (x) + b(x))/q(x) has small factors and that
a(F2 (y))y + b(F2 (y)) has small factors, and hence iterate the process. When enough rela-
tions are collected (including at least one “systematic equation” to remove the parasitic
solution explained on page 442 of Joux/indexAJoux, A. [317]) one can perform linear al-
gebra to solve the DLP. The heuristic complexity of this algorithm is shown in [318] and
Section 15.2.1.2 of [317] to be between Lpn (1/3, 31/3 +o(1)) and Lpn (1/3, (32/9)1/3 +o(1))
for p ≤ Lpn (1/3, (4/9)1/3 + o(1)).
1. One can take random group elements of the form [n]D1 or [n1 ]D1 + [n2 ]D2 and
compute the Mumford representation of the corresponding reduced effective affine
divisor. This is the same approach as used in Section 15.5.1 and, in the context of
ideal/divisor class groups, is sometimes called the Hafner-McCurley algorithm.
344 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
To introduce the instance of the DLP into the system it is necessary to have some relations
involving D1 and D2 . This can either be done using the first method, or by choosing
a(x) and b(x) so that points in the support of either D1 or D2 lie in the support of
div(a(x)+yb(x)) (we have seen this kind of idea already, e.g., in Coppersmith’s algorithm).
It is convenient to add to B all points at infinity and all points P ∈ C(Fq ) such
that P = ι(P ) (equivalently all Fq -rational prime divisors with this property). Since the
latter divisors all have order 2 one automatically obtains relations that can be used to
eliminate them during the linear algebra stage of the algorithm. Hence, we say that a
reduced divisor D = div(u(x), y − v(x)) in Mumford representation is b-smooth if u(x)
is b-smooth after any factors corresponding to points of order 2 have been removed.
Let C be a hyperelliptic curve over Fq of genus g and 1 ≤ b < g. Prime effective
affine divisors on C of degree b correspond to irreducible polynomials u(x) of degree
b (and for roughly half of all such polynomials u(x) there are two solutions v(x) to
v(x)2 + v(x)H(x) − F (x) ≡ 0 (mod u(x))). Hence, it is natural to expect that there
Pb
are approximately q b /b such divisors. It follows that #B should be around i=1 q i /i ≈
1 b
b p (1 + 2/(p − 1)) by the same argument as Exercise 15.5.14.
For the analysis, one needs to estimate the probability that a randomly chosen reduced
divisor is smooth.
Theorem 15.6.1. (Theorem 6 of Enge and Stein [198]) Let C be a hyperelliptic curve of
genus g over Fq . Let c > 1 and let b = ⌈logq (Lqg (1/2, c))⌉. Then the number of b-smooth
reduced divisors of degree g is at least
qg
Lqg (1/2, 1/(2c) + o(1))
Note that the smoothness bound in the above result is the ceiling of a real number.
Hence one cannot deduce subexponential running time unless the genus is sufficiently
large compared with the field size.
group.
15.6. DISCRETE LOGARITHMS ON HYPERELLIPTIC CURVES 345
Exercise√15.6.2. Show that the expected running time of this algorithm is (rigorously!)
Lqg (1/2, 2 + o(1)) bit operations as g → ∞.
We refer to Section VII.5 of [65] for practical details of the algorithm. Note that the
performance can be improved using the sieving method of Flassenberg and Paulus [206].
Exercise 15.6.3. Write pseudocode for the Adleman, DeMarrais, Huang algorithm.
The heuristic complexity of the algorithm is of the same form as the earlier algorithm
(the cost of smoothing the divisors D1 and D2 is heuristically the same as finding less √
than
2g relations so is negligible. One obtains heuristic asymptotic complexity of Lqg (1/2, 2+
o(1)) bit operations as g tends to infinity. This is much better than the complexity claimed
in [4] since that paper also gives an algorithm to compute the group structure (and so
the linear algebra requires computing the Hermite normal form).
These ideas will be used again in Section 15.9.1.
Exercise 15.6.4. Let C be a hyperelliptic curve of genus g over a finite field Fq . Show
that the number of prime divisors on C of degree 1 is #C(Fq ) = q(1 + o(1)) for fixed g
as q → ∞. Hence, show that the probability that a randomly chosen reduced divisor is
1
1-smooth is g! (1 + o(1)) as q → ∞.
346 CHAPTER 15. SUBEXPONENTIAL ALGORITHMS
Exercise 15.6.5. Following Exercise 15.6.4, it is natural to conjecture that one needs to
choose O(g!q(1 + o(1))) divisors (again, this is for fixed g as q → ∞, in which case it is
more common to write it as O(q(1 + o(1)))) to find enough relations to have a non-trivial
linear dependence in B. Under this assumption, show that the heuristic expected running
time of Gaudry’s algorithm is at most
The first term in equation (15.11) is the running time for relation generation. If g is
fixed then asymptotically this is dominated by the second term, which is the running time
for the linear algebra stage. If g is fixed, then the running time is Õ(q 2 ) bit operations.
Hence Gaudry’s algorithm is asymptotically faster than Pollard’s rho method for hyper-
elliptic curves of a fixed genus g ≥ 5. However, the hidden constant in the expression
Õ(q 2 ) depends very badly on g. In practice, Gaudry’s method seems to be superior to
rho for small g (e.g., g = 5, 6, 7).
Harley and Thériault (see [607]) suggested reducing the factor base size in Gaudry’s
algorithm in order to balance the running times of the relation generation and linear alge-
bra stages. Thériault [607] also proposed a “large prime” variant of Gaudry’s algorithm.
Gaudry, Thériault, Thomé and Diem [250] proposed a “double large prime” variant of
Gaudry’s algorithm that is based on the double large prime strategy that was successful
in accelerating integer factorization algorithms. The factor base B is now chosen to be a
subset of the degree one divisors and degree one divisors that are not in B are called large
primes. A divisor is defined to be smooth if it can be written as a sum of prime divisors
and at most two large primes. Relations are collected as before, and then combined to
eliminate the large primes (we refer to Section 21.3 of [16] for further discussion of large
primes and graph methods for eliminating them). It is shown in [250] that, for fixed g,
2
the expected running time of the algorithm is Õ(q 2− g ) bit operations. This is faster than
Pollard rho for g ≥ 3 when q is sufficiently large. Gaudry’s approach was generalised to
all curves of fixed genus by Diem [176].
about a different (constructive) application of Weil restriction of scalars. However, he did mention the
possibility of using this idea for an attack. Galbraith and Smart developed the details further in [229]
and many works followed.
15.8. ELLIPTIC CURVES OVER EXTENSION FIELDS 347
the details since an excellent survey is provided by Hess in Chapter VIII of [65] and many
important details are explained by Diem in [172].
Let E be an elliptic curve over K = Fqn and let k = Fq . The function field of E is
K(E). The idea (called in this setting a covering attack) is to find a curve C over K
such that K(C) is a finite extension of K(E) (so that there is a map C → E of finite
degree) and such that there is an automorphism σ of degree n on K(C) extending the
q-power Frobenius so that the fixed field of K(C) under hσi is k(C 0 ) for some curve C 0 .
The composition of the conorm map from E(K) to Pic0C (K) and the norm map from
Pic0C (K) to Pic0C 0 (k) transfers the DLP from E(K) to Pic0C 0 (k). Hence, as long as the
composition of these maps is not trivial, then one has reduced the DLP from E(K) to
the divisor class group of a curve C 0 over k. One can then solve the DLP using an index
calculus algorithm, which is feasible if the genus of C 0 is not too large.
A variant of the Weil descent concept that avoids function fields and divisor class
groups is to perform index calculus directly on Abelian varieties. This variant is the
subject of the following section.
• Summn is symmetric.
• The degree of Summn in xi is 2n−2 .
Exercise 15.8.3. Prove Theorem 15.8.2.
One way to decompose R = (xR , yR ) in B is to find solutions (x1 , . . . , xn ) ∈ Zn to
If such a solution exists and can be found then one finds the corresponding y-coordinates
±yi . Suppose that each yi ∈ Fp . Then each Pi = (xi , yi ) is in B and by Theorem 15.8.2
there exist si ∈ {−1, 1} such that s1 P1 + · · · + sn Pn = R. The sign bits si can be found
by exhaustive search, thereby yielding a relation. Since #{P1 + P2 + · · · + Pn : Pi ∈ B} ≈
(p1/n )n /n! = p/n! the expected number of points R that have to be selected before a
relation is obtained is about n!.
Unfortunately, no efficient algorithm is known for solving the polynomial equation (15.12)
even for n = 5 (in which case the equation has degree 16 in each of its 5 variables). Cop-
persmith’s method (see Section 19.2) seems not to be useful for this task.
In reference to the remarks of Section 15.2.3 we see that all requirements for an index
calculus algorithm are met, except that it is not efficient to decompose a smooth element
over the factor base.
B = {(x, y) ∈ E(Fqn ) : x ∈ Fq }
so that #B ≈ q. Gaudry considers this as the set of Fq -rational points on the algebraic
set F formed by intersecting the Weil restriction of scalars of E with respect to Fqn /Fq
by n − 1 hyperplanes V (xi ) for 2 ≤ i ≤ n, where x = x1 θ1 + · · · + xn θn (with θ1 = 1) as
in Lemma 5.7.1. If the algebraic set F is irreducible then it is a 1-dimensional variety F .
In the relation generation stage, one attempts to decompose a randomly selected point
R ∈ E(Fqn ) as a sum of points in B. Gaudry observed that this can be accomplished by
finding solutions
Note that Summn+1 (x1 , . . . , xn , xR ) ∈ Fqn [x1 , . . . , xn ] since E is defined over Fqn and
xR ∈ Fqn . The conditions xj ∈ Fq in equation (15.13) can be expressed algebraically as
follows. Select a basis {θ1 , . . . , θn } for Fqn over Fq and write
n
X
Summn+1 (x1 , . . . , xn , xR ) = Gi (x1 , . . . , xn )θi (15.14)
i=1
interested in the points in X(Fq ) (if there are any). Since Fq is finite there are only finitely
many Fq -rational solutions (x1 , . . . , xn ) to the system.
Gaudry assumes that X is generically a zero-dimensional algebraic set (Gaudry justi-
fies this assumption by noting that if F is a variety then the variety F n is n-dimensional,
and so the map from F n to the Weil restriction of E, given by adding together n points
in F , is a morphism between varieties of the same dimension, and so generically has
finite degree). The Fq -rational solutions can therefore be found by finding a Gröbner
basis for the ideal generated by the Gi and then taking roots in Fq of a sequence of uni-
variate polynomials each of which has degree at most 2n(n−1) . This is predicted to take
O(2cn(n−1) M (log(q))) bit operations for some constant c. Alternatively one could add
some field equations xqj − xj to the ideal, to ensure it is zero-dimensional, but this could
have an adverse effect on the complexity. Gaudry makes a further heuristic assumption,
namely that the smoothness probability behaves as expected when using the large prime
variant.
The size of the set {P1 + P2 + · · · + Pn : Pi ∈ B} is approximately q n /n! and so the
expected number of points R that have to be selected before a relation is obtained is about
n!. One needs approximately #B ≈ q relations to be able to find a non-trivial element in
the kernel of the relation matrix and hence integers a and b such that [a]D1 + [b]D2 ≡ 0.
It follows that the heuristic expected running time of Gaudry’s algorithm is
bit operations as q → ∞. This is exponential in terms of n and log(q). However, for fixed
n, the running time can be expressed as Õ(q 2 ) bit operations.
Gaudry’s focus was on n fixed and relatively small. For any fixed n ≥ 5, Gaudry’s
heuristic algorithm for solving the ECDLP over Fqn is asymptotically faster than Pollard’s
rho method. The double large prime variant (mentioned in Section 15.6.3) can also be
2
used in this setting. The complexity therefore becomes (heuristic) Õ(q 2− n ) bit operations.
Hence Gaudry’s algorithm is asymptotically faster than Pollard rho even for n = 3 and
n = 4, namely Õ(q 4/3 ) rather than Õ(q 3/2 ) for n = 3 and Õ(q 3/2 ) rather than Õ(q 2 ) for
n = 4.
The main result of [177] is the following. We stress that this result does not rely on
any heuristics.
Theorem 15.8.4. (Diem) Let a, b ∈ R be such that 0 < a < b. There is an algorithm
such that, if q is a prime power and n ∈ N is such that
p p
a log(q) ≤ n ≤ b log(q)
and E is any elliptic curve over Fqn , then the algorithm solves the DLP in E(Fqn ) in an
n 2/3
expected eO(log(q ) ) bit operations.
bit operations for some constant c. For the discrete logarithm problem the algorithm has
heuristic complexity Lqg (1/3, c′ + o(1)) bit operations where c′ is a constant.
Unlike the LN (1/3, c + o(1)) algorithms for factoring or DLP in finite fields, the al-
gorithm does not use two different factor bases. Instead, the algorithm is basically the
same idea as Sections 15.6.2 and 15.9.1 with a complexity analysis tailored for curves of
a certain form.