![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
SHA-256 in portable C, fed a piece at a time (FIPS 180-4). More...
Go to the source code of this file.
Macros | |
| #define | N_SHA256_ROTR(x, n) |
| rotate right | |
Functions | |
| static void | _sha256_block (uint32_t state[8], const unsigned char block[64]) |
| helper: hash one 64 byte block into the state | |
| void | n_sha256 (const void *data, size_t len, unsigned char out[32]) |
| hash one buffer | |
| int | n_sha256_file (const char *path, unsigned char out[32]) |
| hash a file, read in pieces | |
| void | n_sha256_final (N_SHA256 *ctx, unsigned char out[32]) |
| finish: the digest, the state left spent | |
| void | n_sha256_hex (const unsigned char digest[32], char out[65]) |
| a digest as lowercase hex | |
| void | n_sha256_init (N_SHA256 *ctx) |
| start a hash | |
| void | n_sha256_update (N_SHA256 *ctx, const void *data, size_t len) |
| feed bytes | |
Variables | |
| static const uint32_t | _sha256_k [64] |
| the round constants: the first 32 bits of the fractional parts of the cube roots of the first 64 primes | |
SHA-256 in portable C, fed a piece at a time (FIPS 180-4).
Definition in file n_sha256.c.
| #define N_SHA256_ROTR | ( | x, | |
| n ) |
rotate right
Definition at line 46 of file n_sha256.c.
Referenced by _sha256_block().
|
static |
helper: hash one 64 byte block into the state
Definition at line 49 of file n_sha256.c.
References _sha256_k, and N_SHA256_ROTR.
Referenced by n_sha256_final(), and n_sha256_update().
|
static |
the round constants: the first 32 bits of the fractional parts of the cube roots of the first 64 primes
Definition at line 35 of file n_sha256.c.
Referenced by _sha256_block().