In computational number theory and computational algebra, Pollard's kangaroo algorithm (also Pollard's lambda algorithm, see Naming below) is an algorithm for solving the discrete logarithm problem.
The algorithm was introduced in 1978 by the number theorist John M. Pollard, in the same paper as his better-known Pollard's rho algorithm for solving the same problem.
[1][2] Although Pollard described the application of his algorithm to the discrete logarithm problem in the multiplicative group of units modulo a prime p, it is in fact a generic discrete logarithm algorithm—it will work in any finite cyclic group.
is a finite cyclic group of order
, and we seek to find the discrete logarithm
In other words, one seeks
The lambda algorithm allows one to search for
One may search the entire range of possible logarithms by setting
of positive integers of mean roughly
and define a pseudorandom map
and compute a sequence of group elements
Compute Observe that: 4.
Begin computing a second sequence of group elements
according to: and a corresponding sequence of integers
Stop computing terms of
when either of the following conditions are met: Pollard gives the time complexity of the algorithm as
, using a probabilistic argument based on the assumption that
bits, this is exponential in the problem size (though still a significant improvement over the trivial brute-force algorithm that takes time
For an example of a subexponential time discrete logarithm algorithm, see the index calculus algorithm.
The first is "Pollard's kangaroo algorithm".
This name is a reference to an analogy used in the paper presenting the algorithm, where the algorithm is explained in terms of using a tame kangaroo to trap a wild kangaroo.
Pollard has explained[3] that this analogy was inspired by a "fascinating" article published in the same issue of Scientific American as an exposition of the RSA public key cryptosystem.
The article[4] described an experiment in which a kangaroo's "energetic cost of locomotion, measured in terms of oxygen consumption at various speeds, was determined by placing kangaroos on a treadmill".
The second is "Pollard's lambda algorithm".
Much like the name of another of Pollard's discrete logarithm algorithms, Pollard's rho algorithm, this name refers to the similarity between a visualisation of the algorithm and the Greek letter lambda (
The shorter stroke of the letter lambda corresponds to the sequence
Accordingly, the longer stroke corresponds to the sequence
, which "collides with" the first sequence (just like the strokes of a lambda intersect) and then follows it subsequently.
Pollard has expressed a preference for the name "kangaroo algorithm",[5] as this avoids confusion with some parallel versions of his rho algorithm, which have also been called "lambda algorithms".