doc: describe magic numbers
This commit is contained in:
parent
08bc228d19
commit
a9a76d67f9
3 changed files with 18 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue