Pollard's Rho Algorithm For Logarithms
   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 b^x=a. Analogously, in any group G, powers b^k can be defined for all integers k, and the discrete logarithm \log_b(a) is an integer k such that b^k=a ...
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 th ...
to solve the
integer factorization In mathematics, integer factorization is the decomposition of a positive integer into a product of integers. Every positive integer greater than 1 is either the product of two or more integer factors greater than 1, in which case it is a comp ...
problem. The goal is to compute \gamma such that \alpha ^ \gamma = \beta, where \beta belongs to a
cyclic group In abstract algebra, a cyclic group or monogenous group is a Group (mathematics), group, denoted C_n (also frequently \Z_n or Z_n, not to be confused with the commutative ring of P-adic number, -adic numbers), that is Generating set of a group, ge ...
G generated by \alpha. The algorithm computes
integer An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
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 iden ...
is cyclic of
order Order, ORDER or Orders may refer to: * A socio-political or established or existing order, e.g. World order, Ancien Regime, Pax Britannica * Categorization, the process in which ideas and objects are recognized, differentiated, and understood ...
n, by substituting \beta as ^ 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" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either bo ...
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 id ...
. 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-orie ...
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: Partition G into three disjoint subsets S_0, S_1, and S_2 of approximately equal size using a
hash function A hash function is any Function (mathematics), function that can be used to map data (computing), data of arbitrary size to fixed-size values, though there are some hash functions that support variable-length output. The values returned by a ...
. 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 abstract algebra, a cyclic group or monogenous group is a Group (mathematics), group, denoted C_n (also frequently \Z_n or Z_n, not to be confused with the commutative ring of P-adic number, -adic numbers), that is Generating set of a group, ge ...
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 ''i'' ← 0, ''a''0 ← 0, ''b''0 ← 0, ''x''0 ← 1 ∈ ''G'' loop ''i'' ← ''i'' + 1 ''xi'' ← ''f''(''x''''i''−1), ''ai'' ← ''g''(''x''''i''−1, ''a''''i''−1), ''bi'' ← ''h''(''x''''i''−1, ''b''''i''−1) ''x''2''i''−1 ← ''f''(''x''2''i''−2), ''a''2''i''−1 ← ''g''(''x''2''i''−2, ''a''2''i''−2), ''b''2''i''−1 ← ''h''(''x''2''i''−2, ''b''2''i''−2) ''x''2''i'' ← ''f''(''x''2''i''−1), ''a''2''i'' ← ''g''(''x''2''i''−1, ''a''2''i''−1), ''b''2''i'' ← ''h''(''x''2''i''−1, ''b''2''i''−1) while ''xi'' ≠ ''x''2''i'' ''r'' ← ''bi'' − ''b''2''i'' if r = 0 return failure return ''r''−1(''a''2''i'' − ''ai'') mod ''n''


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++ 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,#Mollin06, Mollin 2006, pg. 344 is a special-purpose algorithm for computing discrete logarithms in a finite abelian group whose order i ...
, the running time of the combined algorithm is \mathcal(\sqrt), where p is the largest prime
factor Factor (Latin, ) 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, such a factor is a resource used ...
of n.


References

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