diff --git a/doc/sha256.tex b/doc/sha256.tex index 6b735fe..6091a80 100644 --- a/doc/sha256.tex +++ b/doc/sha256.tex @@ -89,6 +89,9 @@ W[i] = \begin{cases} The state is initialized to fixed constants derived from the square roots of the first eight prime numbers: +\begin{align*} + \forall (X,p)\in\{(A,2),(B,3),(C,5),(D,7),(E,11),(F,13),(G,17),(H,19)\}, X \leftarrow \left\lfloor \{\sqrt{p}\}\;2^{32}\right\rfloor +\end{align*} \begin{align*} A &= \texttt{0x6a09e667}, \quad B = \texttt{0xbb67ae85}, \quad C = \texttt{0x3c6ef372}, \quad D = \texttt{0xa54ff53a} \\ @@ -100,10 +103,11 @@ After each block is processed, the compressed state is added word-by-word to the state before compression: \begin{align*} -(A, \ldots, H) \leftarrow (A + A_0,\ B + B_0,\ C + C_0,\ D + D_0,\ E + E_0,\ F + F_0,\ G + G_0,\ H + H_0) + \forall X \in \{A, B, C, D, E, F, G ,H\}, \quad X \leftarrow X + X_0 \end{align*} -\noindent where $A_0, \ldots, H_0$ denote the state at the beginning of the + +\noindent where $X_0$ denote the state at the beginning of the block. After all blocks have been processed, the eight state words are serialized in big-endian order to produce the 256-bit digest.