HOME

TheInfoList



OR:

Pollard's rho algorithm for logarithms is an algorithm introduced by John Pollard in 1978 to solve the
discrete logarithm In mathematics, for given real numbers ''a'' and ''b'', the logarithm log''b'' ''a'' is a number ''x'' such that . Analogously, in any group ''G'', powers ''b'k'' can be defined for all integers ''k'', and the discrete logarithm log''b' ...
problem, analogous to
Pollard's rho algorithm Pollard's rho algorithm is an algorithm for integer factorization. It was invented by John Pollard in 1975. It uses only a small amount of space, and its expected running time is proportional to the square root of the smallest prime factor of the ...
to solve the
integer factorization In number theory, integer factorization is the decomposition of a composite number into a product of smaller integers. If these factors are further restricted to prime numbers, the process is called prime factorization. When the numbers are suf ...
problem. The goal is to compute \gamma such that \alpha ^ \gamma = \beta, where \beta belongs to a
cyclic group In group theory, a branch of abstract algebra in pure mathematics, a cyclic group or monogenous group is a group, denoted C''n'', that is generated by a single element. That is, it is a set of invertible elements with a single associative bina ...
G generated by \alpha. The algorithm computes
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s a, b, A, and B such that \alpha^a \beta^b = \alpha^A \beta^B. If the underlying
group A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic ide ...
is cyclic of order n, by substituting \beta as a^ and noting that two powers are equal
if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (shortened as "iff") is a biconditional logical connective between statements, where either both statements are true or both are false. The connective is bicondi ...
the exponents are equivalent modulo the order of the base, in this case modulo n, we get that \gamma is one of the solutions of the equation (B-b) \gamma = (a-A) \pmod n. Solutions to this equation are easily obtained using the
extended Euclidean algorithm In arithmetic and computer programming, the extended Euclidean algorithm is an extension to the Euclidean algorithm, and computes, in addition to the greatest common divisor (gcd) of integers ''a'' and ''b'', also the coefficients of Bézout's ide ...
. To find the needed a, b, A, and B the algorithm uses Floyd's cycle-finding algorithm to find a cycle in the sequence x_i = \alpha^ \beta^, where the
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
f: x_i \mapsto x_ is assumed to be random-looking and thus is likely to enter into a loop of approximate length \sqrt after \sqrt steps. One way to define such a function is to use the following rules: Divide G into three disjoint subsets of approximately equal size: S_0, S_1, and S_2. If x_i is in S_0 then double both a and b; if x_i \in S_1 then increment a, if x_i \in S_2 then increment b.


Algorithm

Let G be a
cyclic group In group theory, a branch of abstract algebra in pure mathematics, a cyclic group or monogenous group is a group, denoted C''n'', that is generated by a single element. That is, it is a set of invertible elements with a single associative bina ...
of order n, and given \alpha, \beta\in G, and a partition G = S_0\cup S_1\cup S_2, let f:G\to G be the map : f(x) = \begin \beta x & x\in S_0\\ x^2 & x\in S_1\\ \alpha x & x\in S_2 \end and define maps g:G\times\mathbb\to\mathbb and h:G\times\mathbb\to\mathbb by :\begin g(x,k) &= \begin k & x\in S_0\\ 2k \pmod & x\in S_1\\ k+1 \pmod & x\in S_2 \end \\ h(x,k) &= \begin k+1 \pmod & x\in S_0\\ 2k \pmod & x\in S_1\\ k & x\in S_2 \end \end input: ''a'': a generator of ''G'' ''b'': an element of ''G'' output: An integer ''x'' such that ''ax'' = ''b'', or failure Initialise ''a''0 ← 0, ''b''0 ← 0, ''x''0 ← 1 ∈ ''G'' ''i'' ← 1 loop ''xi'' ← ''f''(''x''''i''-1), ''ai'' ← ''g''(''x''''i''-1, ''a''''i''-1), ''bi'' ← ''h''(''x''''i''-1, ''b''''i''-1) ''x''2''i'' ← ''f''(''f''(''x''2''i''-2)), ''a''2''i'' ← ''g''(''f''(''x''2''i''-2), ''g''(''x''2''i''-2, ''a''2''i''-2)), ''b''2''i'' ← ''h''(''f''(''x''2''i''-2), ''h''(''x''2''i''-2, ''b''2''i''-2)) if ''xi'' = ''x''2''i'' then ''r'' ← ''bi'' - ''b''2''i'' if r = 0 return failure ''x'' ← ''r''−1(''a''2''i'' - ''ai'') mod ''n'' return ''x'' else // ''xi'' ≠ ''x''2''i'' ''i'' ← ''i'' + 1 end if end loop


Example

Consider, for example, the group generated by 2 modulo N=1019 (the order of the group is n=1018, 2 generates the group of units modulo 1019). The algorithm is implemented by the following
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
program: #include const int n = 1018, N = n + 1; /* N = 1019 -- prime */ const int alpha = 2; /* generator */ const int beta = 5; /* 2^ = 1024 = 5 (N) */ void new_xab(int& x, int& a, int& b) int main(void) The results are as follows (edited): i x a b X A B ------------------------------ 1 2 1 0 10 1 1 2 10 1 1 100 2 2 3 20 2 1 1000 3 3 4 100 2 2 425 8 6 5 200 3 2 436 16 14 6 1000 3 3 284 17 15 7 981 4 3 986 17 17 8 425 8 6 194 17 19 .............................. 48 224 680 376 86 299 412 49 101 680 377 860 300 413 50 505 680 378 101 300 415 51 1010 681 378 1010 301 416 That is 2^ 5^ = 1010 = 2^ 5^ \pmod and so (416-378)\gamma = 681-301 \pmod, for which \gamma_1=10 is a solution as expected. As n=1018 is not
prime A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
, there is another solution \gamma_2=519, for which 2^ = 1014 = -5\pmod holds.


Complexity

The running time is approximately \mathcal(\sqrt). If used together with the
Pohlig–Hellman algorithm In group theory, the Pohlig–Hellman algorithm, sometimes credited as the Silver–Pohlig–Hellman algorithm, Mollin 2006, pg. 344 is a special-purpose algorithm for computing discrete logarithms in a finite abelian group whose order is a smoot ...
, the running time of the combined algorithm is \mathcal(\sqrt), where p is the largest prime
factor Factor, a Latin word meaning "who/which acts", may refer to: Commerce * Factor (agent), a person who acts for, notably a mercantile and colonial agent * Factor (Scotland), a person or firm managing a Scottish estate * Factors of production, suc ...
of n.


References

* * {{Number-theoretic algorithms Logarithms Number theoretic algorithms