williams+1.tex 6.6 KB

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