From d89e7a37d6f0db383f881b7fd96b3ba2b2e3eb29 Mon Sep 17 00:00:00 2001 From: lohhiiccc Date: Mon, 11 May 2026 18:46:40 +0200 Subject: [PATCH] refactor: rework newline --- doc/generic_interface.tex | 2 -- doc/introduction.tex | 2 -- doc/libft_ssl.tex | 7 +++++++ doc/md5.tex | 2 -- doc/preliminaries.tex | 3 --- doc/ressource.tex | 6 ++++++ doc/sha256.tex | 2 -- doc/whirlpool.tex | 13 +++++++++---- 8 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 doc/ressource.tex diff --git a/doc/generic_interface.tex b/doc/generic_interface.tex index 67efd9b..9923f7f 100644 --- a/doc/generic_interface.tex +++ b/doc/generic_interface.tex @@ -49,5 +49,3 @@ compressed output is combined with the previous state to produce the new state --- this chaining ensures that the final digest depends on every bit of the input. The exact combination operation is algorithm-specific: MD5 and SHA-256 use an additive feedforward, while Whirlpool uses the Miyaguchi-Preneel scheme. - -\newpage diff --git a/doc/introduction.tex b/doc/introduction.tex index 8c296e3..c1c0938 100644 --- a/doc/introduction.tex +++ b/doc/introduction.tex @@ -15,5 +15,3 @@ The library currently implements the following algorithms: These functions are commonly used for data integrity verification, digital signatures, and \textbf{M}essage \textbf{A}uthentication \textbf{C}ode\textbf{s} (MACs). - -\newpage diff --git a/doc/libft_ssl.tex b/doc/libft_ssl.tex index 8148d07..51b04f1 100644 --- a/doc/libft_ssl.tex +++ b/doc/libft_ssl.tex @@ -22,10 +22,17 @@ \newpage \input{preliminaries} +\newpage \input{introduction} +\newpage \input{generic_interface} +\newpage \input{md5} +\newpage \input{sha256} +\newpage \input{whirlpool} +\newpage +\input{ressource} \end{document} diff --git a/doc/md5.tex b/doc/md5.tex index d766b5f..7e6846b 100644 --- a/doc/md5.tex +++ b/doc/md5.tex @@ -98,5 +98,3 @@ the state before compression: \noindent where $A_0$, $B_0$, $C_0$, $D_0$ denote the state at the beginning of the block. After all blocks have been processed, the four state words are serialized in little-endian order to produce the 128-bit digest. - -\newpage diff --git a/doc/preliminaries.tex b/doc/preliminaries.tex index e6a82eb..45c3866 100644 --- a/doc/preliminaries.tex +++ b/doc/preliminaries.tex @@ -46,7 +46,6 @@ one block of data, and produces a new state. The \textbf{Miyaguchi-Preneel} construction is a way to build a compression function from a block cipher $E$. Given a current state $H$ and a message block $M$, it produces a new state as: - \begin{align*} H \leftarrow E(H,\ M) \oplus M \oplus H \end{align*} @@ -62,5 +61,3 @@ internal state is wider than the final digest. This makes collision attacks harder: an attacker targeting the output must first find a collision in the larger internal state, which requires significantly more work than attacking the digest directly. - -\newpage diff --git a/doc/ressource.tex b/doc/ressource.tex new file mode 100644 index 0000000..b605c2c --- /dev/null +++ b/doc/ressource.tex @@ -0,0 +1,6 @@ +\section{Ressource} +https://en.wikipedia.org/wiki/Finite_field_arithmetic + +https://en.wikipedia.org/wiki/Rijndael_MixColumns %maybe idk + + diff --git a/doc/sha256.tex b/doc/sha256.tex index 6091a80..b064375 100644 --- a/doc/sha256.tex +++ b/doc/sha256.tex @@ -110,5 +110,3 @@ the state before compression: \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. - -\newpage diff --git a/doc/whirlpool.tex b/doc/whirlpool.tex index 8d5fbd2..d516e45 100644 --- a/doc/whirlpool.tex +++ b/doc/whirlpool.tex @@ -21,10 +21,12 @@ The padding scheme follows the same structure as MD5 and SHA-256: a single length is congruent to 448 bits modulo 512. The original message length in bits is then appended as a 64-bit big-endian integer. -\vspace{1em} +\newpage Each round applies the following four transformations in order: +\medskip + \textbf{SubBytes} replaces each byte of the state matrix by its image under the Whirlpool S-box, a fixed 256-entry lookup table defined in the Whirlpool specification. @@ -51,14 +53,17 @@ row $i$, each output byte $b_j$ is computed as: b_j = \bigoplus_{k=0}^{7} \mathrm{MDS}[(j - k) \bmod 8] \cdot a_{i,k} \end{align*} -\noindent where $\cdot$ denotes multiplication in $\mathrm{GF}(2^8)$ and -$\oplus$ denotes XOR. +\noindent where $\cdot$ denotes multiplication in $\mathrm{GF}(2^8)$ and $\oplus$ denotes XOR. \medskip \textbf{AddRoundKey} XORs the state with the current round key. -\vspace{1em} +\begin{align*} + %TODO: \forall i \in \mathbb{N},\ 0 \leq i < 8, +\end{align*} + +\newpage The S-box and the MDS matrix coefficients are fixed tables defined in the Whirlpool specification; their values are too large to reproduce here. The