Pārlūkot izejas kodu

Pseudocode: adding public key argument to questions.

Michele Orrù 11 gadi atpakaļ
vecāks
revīzija
6b888f0d1b

+ 1 - 1
book/dixon.tex

@@ -216,7 +216,7 @@ $e^{\sqrt{\ln N \ln \ln N}}$.
   \caption{Dixon}
   \begin{algorithmic}[1]
     \Require $\factorBase$, the factor base
-    \Function{dixon}{ }
+    \Function{dixon}{\PKArg}
     \State $i \gets 0$
     \State $r \gets |\factorBase| + 5$
     \Comment finding linearity requires redundance

+ 1 - 1
book/fermat.tex

@@ -64,7 +64,7 @@ aforementioned.
 \begin{algorithm}[H]
   \caption{Fermat Factorization \label{alg:fermat}}
   \begin{algorithmic}[1]
-    \Function{fermat}{ }
+    \Function{fermat}{\PKArg}
     \State $x \gets \floor{\sqrt{N}}$
     \State $x' \gets x \cdot x$
 

+ 2 - 1
book/math_prequisites.tex

@@ -86,6 +86,7 @@ Anyway, both show that algorithm ~\ref{alg:gcd} belongs to the class
 \begin{algorithm}[H]
   \caption{\openssl's GCD \label{alg:gcd}}
   \begin{algorithmic}[1]
+    \Function{gcd}{$a, b$}
     \State $k \gets 0$
     \While{$b \neq 0$}
       \If{$a$ is odd}
@@ -111,7 +112,7 @@ Anyway, both show that algorithm ~\ref{alg:gcd} belongs to the class
       \EndIf
     \EndWhile
     \State \Return $a \ll k$
-
+    \EndFunction
   \end{algorithmic}
 \end{algorithm}
 

+ 2 - 2
book/pollardrho.tex

@@ -179,7 +179,7 @@ and respectively updating them via $x \gets f(x)$ and $y \gets f(f(y))$.
 \begin{algorithm}
   \caption{Pollard's $\rho$ factorization}
   \begin{algorithmic}[1]
-    \Function{rho}{ }
+    \Function{rho}{\PKArg}
     \State $x \getsRandom \naturalN$
     \State $y \gets x$
     \State $g \gets 1$
@@ -208,7 +208,7 @@ adopts this trick together with Brent's cycle-finding variant:
 \begin{algorithm}
   \caption{Pollard-Brent's factorization \label{alg:pollardrho}}
   \begin{algorithmic}[1]
-    \Function{rho}{ }
+    \Function{rho}{\PKArg}
     \State $s \gets 100$
     \Comment steps to check for $\gcd$
     \State $i \gets 1; \quad j' \gets j \gets 1$

+ 2 - 1
book/question_authority.tex

@@ -57,7 +57,8 @@
 \newcommand{\rfrac}[2]{{}^{#1}\!/_{#2}}
 \newcommand{\getsRandom}{\xleftarrow{r}}
 \newcommand{\xor}{\oplus}
-
+\newcommand{\legendre}[2]{({#1}/{#2})}
+\newcommand{\PKArg}{\textit{PubKey:}$\angular{N, e}$}
 \theoremstyle{plain}
 \newtheorem*{theorem*}{Theorem}
 \newtheorem*{definition*}{Definition}

+ 2 - 2
book/wiener.tex

@@ -162,9 +162,9 @@ convergent, we provide an algorithm for attacking the RSA cipher via Wiener:
   \caption{Wiener's Attack}
   \label{alg:wiener}
   \begin{algorithmic}[1]
-    \Function{wiener}{ }
+    \Function{wiener}{\PKArg}
     \State $f \gets  \texttt{cf\_init}(e, N)$
-    \For{$\ceil{\log N} \text{ times }$}
+    \For{$\ceil{\log N} \strong{ times }$}
       \State $k, d \gets \texttt{cf\_next}(f)$
       \If{$k \nmid ed-1$} \strong{continue} \EndIf
       \State $\eulerphi{N} \gets (ed - 1)\ //\ k$