Compare commits
3 commits
0da22db6fa
...
27d2c8d21a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27d2c8d21a | ||
|
|
a9a76d67f9 | ||
|
|
08bc228d19 |
5 changed files with 37 additions and 0 deletions
|
|
@ -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
|
produce the final digest --- MD5 uses little-endian, while SHA-256 and
|
||||||
Whirlpool use big-endian.
|
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}
|
\vspace{1em}
|
||||||
|
|
||||||
A \textbf{message} is the arbitrary-length input fed to a hash function. The
|
A \textbf{message} is the arbitrary-length input fed to a hash function. The
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,11 @@
|
||||||
|
|
||||||
\vspace{0.5em}
|
\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}.\\
|
\item Wikipedia, \textit{AES}.\\
|
||||||
\url{https://en.wikipedia.org/wiki/Advanced_Encryption_Standard}
|
\url{https://en.wikipedia.org/wiki/Advanced_Encryption_Standard}
|
||||||
|
|
||||||
|
|
@ -36,6 +41,11 @@
|
||||||
\item Wikipedia, \textit{Bitwise operation}.\\
|
\item Wikipedia, \textit{Bitwise operation}.\\
|
||||||
\url{https://en.wikipedia.org/wiki/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}
|
\end{itemize}
|
||||||
%https://revistarsc.com.br/ojs/index.php/rsc/article/download/123/version/139/91/280
|
%https://revistarsc.com.br/ojs/index.php/rsc/article/download/123/version/139/91/280
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ const uint32_t g_md5_s[64] = {
|
||||||
|
|
||||||
#undef S_ROUND
|
#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] = {
|
const uint32_t g_md5_T[64] = {
|
||||||
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
|
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
|
||||||
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
|
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
#include "sha256.h"
|
#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] = {
|
const uint32_t g_sha256_K[64] = {
|
||||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
#include "sha256.h"
|
#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)
|
void sha256_init(void *ctx)
|
||||||
{
|
{
|
||||||
struct sha256_ctx *local_ctx = ctx;
|
struct sha256_ctx *local_ctx = ctx;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue