libft_ssl/src/sha256/sha256_init.c
2026-05-19 14:50:36 +02:00

23 lines
522 B
C

#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;
local_ctx->state[0] = 0x6a09e667;
local_ctx->state[1] = 0xbb67ae85;
local_ctx->state[2] = 0x3c6ef372;
local_ctx->state[3] = 0xa54ff53a;
local_ctx->state[4] = 0x510e527f;
local_ctx->state[5] = 0x9b05688c;
local_ctx->state[6] = 0x1f83d9ab;
local_ctx->state[7] = 0x5be0cd19;
local_ctx->count = 0;
}