pollard+1.tex 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. \chapter{Williams' $p+1$ factorization method \label{chap:william+1}}
  2. Analogously to Pollard's $p-1$ factorization described in chapter
  3. ~\ref{chap:pollard-1}, this method will allow the determination of the divisor
  4. $p$ of a number $N$, if $p$ is such that $p+1$ has only small prime divisors.
  5. This method was presented in ~\cite{Williams:p+1} together with the results of
  6. the application of this method to a large number of composite numbers.
  7. \section{Background on Lucas Sequences}
  8. Let us call \emph{Lucas Sequence} the recurrence relation with parameters $\tau,
  9. \upsilon$
  10. \begin{align*}
  11. \begin{cases}
  12. U_0 = 0 \\
  13. U_1 = 1 \\
  14. U_n = \tau U_{n-1} - \upsilon U_{n-2}
  15. \end{cases}
  16. \quad
  17. \begin{cases}
  18. V_0 = 2 \\
  19. V_1 = \tau \\
  20. V_n = \tau V_{n-1} - \upsilon V_{n-2}
  21. \end{cases}
  22. \end{align*}
  23. %% <https://en.wikipedia.org/wiki/Lucas_sequence> thanks wikipedia
  24. For respectively different values of $\tau, \upsilon$, Lucas Sequences have
  25. specific names:
  26. \begin{tabular}{c l@{\hskip 0pt} l@{\hskip 1pt} l l l}
  27. $\bullet$ & $U($ & $\tau=1,$ & $\upsilon=-1)$ & \emph{Fibonacci numbers}; \\
  28. $\bullet$ & $V($ & $\tau=1,$ & $\upsilon=-1)$ & \emph{Lucas numbers}; \\
  29. $\bullet$ & $U($ & $\tau=3,$ & $\upsilon=2)$ & \emph{Mersenne numbers}.\\
  30. \end{tabular}
  31. \\
  32. \\
  33. For our purposes, $U_n$ is not necessary, and $\upsilon=1$\footnote{
  34. Williams justifies this choice stating that choosing to compute a $U_n$ sequence
  35. is far more computationally expensive than involving $V_n$; for what
  36. concerns $\upsilon$, that simplifies Lehmer's theorem with no loss of
  37. generality. For further references,
  38. see \cite{Williams:p+1} \S 3.}.
  39. In order to simplify any later theorem, we just omit it. Therefore, the latter
  40. expression becomes:
  41. \begin{equation}
  42. \label{eq:williams:ls}
  43. \begin{cases}
  44. V_0 = 2 \\
  45. V_1 = \tau \\
  46. V_n = \tau V_{n-1} - V_{n-2} \\
  47. \end{cases}
  48. \end{equation}
  49. Three foundamental properties interpolate terms of Lucas Sequences:
  50. \begin{align}
  51. & V_{2n+1} = \tau V_n - V_{n-1} \label{eq:ls:2n+1}\\
  52. & V_{2n} = V_n^2 - 2 \label{eq:ls:2n}\\
  53. & V_{2n-1} = V_nV_{n-1} - \tau \label{eq:ls:2n-1}
  54. \end{align}
  55. All these identities can be verified by direct substitution with
  56. \ref{eq:williams:ls}. What's interesting about the ones of above, is that we can
  57. exploit those to efficiently compute the product $V_{hk}$ if we are provided with
  58. $\angular{V_k, V_{k-1}}$ by considering the binary representation of the number
  59. $h$. In other words, we can consider each bit of $h$, starting from the least
  60. significant one: if it is zero, we use the multiplication formula
  61. \ref{eq:ls:2n}; otherwise the two addition formulas \ref{eq:ls:2n+1} and
  62. \ref{eq:ls:2n-1}.
  63. \begin{algorithm}[H]
  64. \caption{Lucas Sequence Multiplier}
  65. \begin{algorithmic}[1]
  66. \Function{Lucas}{$V, V', a, \tau$}
  67. \While{$a > 0$}
  68. \If{$a$ is even }
  69. \State $V'' \gets V^2 -2$
  70. \Comment by equation \ref{eq:ls:2n}
  71. \State $V' \gets VV' - \tau$
  72. \Comment by equation \ref{eq:ls:2n-1}
  73. \State $v \gets V''$
  74. \ElsIf{$a$ is odd}
  75. \State $V'' \gets \tau V^2 - VV' - \tau$
  76. \Comment by equation \ref{eq:ls:2n+1}
  77. \State $V' \gets V^2 -2$
  78. \Comment by equation \ref{eq:ls:2n}
  79. \State $V \gets V''$
  80. \EndIf
  81. \State $a \gets a \gg 1$
  82. \EndWhile
  83. \State \Return $V, V'$
  84. \EndFunction
  85. \end{algorithmic}
  86. \end{algorithm}
  87. Finally, we need the following (\cite{Williams:p+1} \S 2):
  88. \begin{theorem*}[Lehmer]
  89. If $p$ is an odd prime and the Legendre symbol
  90. $\legendre{\Delta}{p} = \varepsilon$, then:
  91. \begin{align*}
  92. %% & U_{(p - \varepsilon)m} \equiv 0 \pmod{p} \\
  93. & V_{(p - \varepsilon)m} \equiv 2 \pmod{p}
  94. \end{align*}
  95. \end{theorem*}
  96. \begin{remark}
  97. From number theory we know that the probability that
  98. $\mathbb{P}\{\epsilon = -1\} = \rfrac{1}{2}$.
  99. But, there is reason to restrict ourselves for $\legendre{\Delta}{p} = -1$.
  100. What's woth noring, though, is that a $p-1$ factorization attempt would be
  101. quite slow with respect to Pollard's $p-1$ method. As a consequence of this,
  102. we and \cite{Williams:p+1} proceeded running pollard first????
  103. \end{remark}
  104. \section{Dressing up}
  105. At this point the factorization proceeds just by substituting the
  106. exponentiation and Fermat's theorem with lucas sequences and Lehmer's theorem
  107. introduced in the preceeding section. If we find a $Q$ satisfying $p+1 \mid Q
  108. \text{ or } p-1 \mid Q$ then, due to Lehmer's theorem $p \mid V_Q -2$ and thus
  109. $\gcd(V_Q -2, N)$ is a non-trial divisor of $N$.
  110. \begin{enumerate}[(i)]
  111. \item take a random, initial $\tau = V_1$; now let the \emph{base} be
  112. $\angular{V_0, V_1}$.
  113. \item take the $i$-th prime in $\mathcal{P}$, starting from $0$, and call it be
  114. $p_i$;
  115. \item assuming the current state is $\angular{V_k, V_{k-1}}$, compute the
  116. successive terms of the sequence using additions and multiplications formula,
  117. until you have $\angular{V_{p_ik}, V_{p_ik - 1}}$.
  118. \item just like with the Pollard $p-1$ method, repeat step (iii) for $e =
  119. \ceil{\frac{\log N}{\log p_i}}$ times;
  120. \item select $Q = V_k - 2 \pmod{N}$ and check the $gcd$ with $N$, hoping this
  121. leads to one of the two prime factors:
  122. \begin{align}
  123. g = gcd(Q, N), \quad 1 < g < N \,.
  124. \end{align}
  125. If so, than we have finished, since $g$ itself and $\frac{N}{g}$
  126. are the two primes factorizing the public modulus.
  127. Otherwise, if $g = 1$ we go back to to (ii), since $p-1 \nmid Q$ yet;
  128. if $g = N$ start back from scratch, as $pq \mid g_i$.
  129. %% riesel actually does not examine this case, strangely. However, it seems to
  130. %% be fairly probable that.
  131. \end{enumerate}
  132. \begin{algorithm}
  133. \caption{Williams $p+1$ factorization}
  134. \begin{algorithmic}[1]
  135. \Require $\mathcal{P}$, the prime pool
  136. \Function{Factorize}{$N, \tau$}
  137. \State $V \gets 2$
  138. \State $V' \gets \tau$
  139. \For{$p_i \strong{ in } \mathcal{P}$}
  140. \Comment step (i)
  141. \State $e \gets \log \sqrt{N} // \log p_i$
  142. \For{$e \strong{ times }$}
  143. \State $V, V' \gets \textsc{lucas}(V, V', p_i, \tau)$
  144. \Comment step (ii)
  145. \State $Q \gets V -2$
  146. \State $g \gets \gcd(Q, N)$
  147. \Comment step (iii)
  148. \If{$g = 1$} \Return \strong{nil}
  149. \ElsIf{$g > 1$} \Return g
  150. \EndIf
  151. \EndFor
  152. \EndFor
  153. \EndFunction
  154. \end{algorithmic}
  155. \end{algorithm}
  156. %%% Local Variables:
  157. %%% mode: latex
  158. %%% TeX-master: "question_authority"
  159. %%% End: