Compare commits

...

3 commits

Author SHA1 Message Date
lohhiiccc
27d2c8d21a doc: update preliminaries endianness 2026-05-19 14:50:55 +02:00
lohhiiccc
a9a76d67f9 doc: describe magic numbers 2026-05-19 14:50:36 +02:00
lohhiiccc
08bc228d19 doc: update ressources 2026-05-19 14:50:24 +02:00
5 changed files with 37 additions and 0 deletions

View file

@ -21,6 +21,15 @@ stored first. This distinction matters when serializing the internal state to
produce the final digest --- MD5 uses little-endian, while SHA-256 and
Whirlpool use big-endian.
\[
\text{Value}\; 0xD41D8CD9:
\begin{cases}
\text{Big-endian: } & \text{d4}\;\mid\;\text{1d}\;\mid\;\text{8c}\;\mid\;\text{d9}\\
\text{Little-endian: } & \text{d9}\;\mid\;\text{8c}\;\mid\;\text{1d}\;\mid\;\text{d4}
\end{cases}
\]
\vspace{1em}
A \textbf{message} is the arbitrary-length input fed to a hash function. The

View file

@ -12,6 +12,11 @@
\vspace{0.5em}
\item Whirlpool \textit{reference implementations}.\\
\url{https://web.archive.org/web/20171129084214/http://www.larc.usp.br/~pbarreto/WhirlpoolPage.html}
\vspace{0.5em}
\item Wikipedia, \textit{AES}.\\
\url{https://en.wikipedia.org/wiki/Advanced_Encryption_Standard}
@ -36,6 +41,11 @@
\item Wikipedia, \textit{Bitwise operation}.\\
\url{https://en.wikipedia.org/wiki/Bitwise_operation}
\vspace{0.5em}
\item Wikipedia, \textit{Miyaguchi Preneel}.\\
\url{https://en.wikipedia.org/wiki/One-way_compression_function#Miyaguchi.E2.80.93Preneel}
\end{itemize}
%https://revistarsc.com.br/ojs/index.php/rsc/article/download/123/version/139/91/280

View file

@ -13,6 +13,11 @@ const uint32_t g_md5_s[64] = {
#undef S_ROUND
/*
* import math
* for i in range(0, 64):
* hex(math.floor(math.pow(2, 32) * abs(math.sin(i+1))))
*/
const uint32_t g_md5_T[64] = {
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,

View file

@ -1,5 +1,12 @@
#include "sha256.h"
/*
* for i in range(0, 64):
* p = nth_prime(i + 1)
* value = math.floor((2**32) * ((p ** (1/3)) % 1))
* print(hex(int(value)))
*/
const uint32_t g_sha256_K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,

View file

@ -1,5 +1,11 @@
#include "sha256.h"
/*
* for i in range(0,8):
* p = nth_prime(i + 1)
* frac = math.sqrt(p) % 1
* print(hex(int(frac * 2**32)))
*/
void sha256_init(void *ctx)
{
struct sha256_ctx *local_ctx = ctx;