Pollard's rho algorithm for logarithms: Difference between revisions

Content deleted Content added
Algorithm: Simplify pseudocode (step 1): Clarify computation of x_{2i}, a_{2i} and b_{2i} by introducing x_{2i-1}, a_{2i-1} and b_{2i-1} temporaries.
fix link in references
 
(One intermediate revision by one other user not shown)
Line 38:
'''output:''' An integer ''x'' such that ''a<sup>x</sup>'' = ''b'', or failure
Initialise ''i'' &larr; 0, ''a''<sub>0</sub> &larr; 0, ''b''<sub>0</sub> &larr; 0, ''x''<sub>0</sub> &larr; 1 &isin; ''G''
''i'' &larr; 1
'''loop'''
''x<sub>i</sub>'' &larr; ''f''(''x''<sub>''i''- + 1</sub>),
''a<sub>i</sub>'' &larr; ''g''(''x''<sub>''i''-1</sub>, ''a''<sub>''i''-1</sub>),
''b<sub>i</sub>'' &larr; ''h''(''x''<sub>''i''-1</sub>, ''b''<sub>''i''-1</sub>)
''x''<sub>2''i''-1</sub>'' &larr; ''f''(''x''<sub>2''i''-2−1</sub>),
''a''<sub>2''i''-1</sub>'' &larr; ''g''(''x''<sub>2''i''-2−1</sub>, ''a''<sub>2''i''-2−1</sub>),
''b''<sub>2''i''-1</sub>'' &larr; ''h''(''x''<sub>2''i''-2−1</sub>, ''b''<sub>2''i''-2−1</sub>)
''x''<sub>2''i''</sub> &larr; ''f''(''x''<sub>2''i''-1</sub>),
''a''<sub>2''i''</sub> &larr; ''g''(''x''<sub>2''i''-1</sub>, ''a''<sub>2''i''-1</sub>),
''b''<sub>2''i''</sub> &larr; ''h''(''x''<sub>2''i''-1</sub>, ''b''<sub>2''i''-1</sub>)
''x'if'<sub>2'' i''x<sub>i−1</sub>'' =&larr; ''f''(''x''<sub>2''i''−2</sub> '''then'''),
''ra''<sub>2''i''−1</sub> &larr; ''bg''(''x''<sub>2''i''−2</sub>'' -, ''ba''<sub>2''i''−2</sub>),
''b''<sub>2''i''−1</sub>'' &larr; ''h''(''x''<sub>2''i''-1−2</sub>, ''b''<sub>2''i''-1−2</sub>)
'''if''' r = 0 '''return failure'''
''x''<sub>2''i''</sub> &larr; ''rf''<sup>−1</sup>(''ax''<sub>2''i''−1</sub> - ''a<sub>i</sub>'') mod ''n'',
''a''<sub>2''i''</sub>'' &larr; ''g''(''x''<sub>2''i''-1−1</sub>, ''a''<sub>2''i''-1−1</sub>),
'''return''' ''x''
''b'else'<sub>2'' <i>// ''x<sub>i</sub>'' &nelarr; ''h''(''x''<sub>2''i''−1</sub>, ''b''</sub>2''i''−1</sub>)
'''while''' ''x<sub>i</sub>'' &larrne; ''x''<sub>2''i'' + 1</sub>
'''end if'''
''r'' &larr; ''x''b<sub>2''i''</sub>'' &larr; ''f''(''xb''<sub>2''i''-1</sub>),
'''end loop'''
'''if''' r = 0 '''return failure'''
'''return''' ''r''<sup><span class="nowrap" style="padding-left:0.1em">−1</span></sup>(''a''<sub>2''i''</sub> − ''a<sub>i</sub>'') mod ''n''
 
==Example==
Line 121 ⟶ 117:
{{Reflist}}
*{{cite journal |first=J. M. |last=Pollard |title=Monte Carlo methods for index computation (mod ''p'') |journal=[[Mathematics of Computation]] |volume=32 |year=1978 |issue=143 |pages=918–924 |doi= 10.2307/2006496 |jstor=2006496 }}
*{{cite book |first1=Alfred J. |last1=Menezes |first2=Paul C. |last2=van Oorschot |first3=Scott A. |last3=Vanstone |chapter-url=httphttps://www.cacr.math.uwaterloo.ca/hac/about/chap3.pdf |title=Handbook of Applied Cryptography |chapter=Chapter 3 |year=2001 }}
 
{{Number-theoretic algorithms}}