Loading...
Searching...
No Matches
sha256fst.c
Go to the documentation of this file.
305 valid = valid && consumed == before.st_size && fstat(descriptor, &after) == 0 && before.st_dev == after.st_dev &&
void sha256_bytes(const void *data, size_t length, void *output)
Hash one memory region to its standard 32-byte binary digest.
Definition sha256fst.c:279
static uint32_t round_sigma_one(uint32_t value)
Uppercase Sigma-1 for the fifth working word in a compression round.
Definition sha256fst.c:90
void sha256_append_byte(struct sha256 *context, uint8_t byte)
Append one byte to an unfinished message.
Definition sha256fst.c:181
static uint32_t schedule_sigma_zero(uint32_t value)
Lowercase sigma-0 for expansion of the message schedule.
Definition sha256fst.c:63
bool sha256_file(const char *filename, char output[SHA256_HEX_SIZE])
Hash an immutable nonempty regular file with bounded streaming scratch.
Definition sha256fst.c:286
void sha256_hex(const void *data, size_t length, char *output)
Hash one memory region to a lowercase hexadecimal string.
Definition sha256fst.c:272
void sha256_finalize_hex(struct sha256 *context, char *output)
Finish a message and write its lowercase hexadecimal digest.
Definition sha256fst.c:249
static uint32_t round_sigma_zero(uint32_t value)
Uppercase Sigma-0 for the first working word in a compression round.
Definition sha256fst.c:81
void sha256_finalize(struct sha256 *context)
Finish a message, leaving its eight digest words in context->state.
Definition sha256fst.c:226
void sha256_append(struct sha256 *context, const void *data, size_t length)
Append an arbitrarily aligned chunk; empty chunks are harmless.
Definition sha256fst.c:190
void sha256_init(struct sha256 *context)
Initialize or reset a context for a new message.
Definition sha256fst.c:168
static void compress_block(struct sha256 *context, const uint8_t *block)
Fold exactly one complete input block into the chaining state.
Definition sha256fst.c:102
static uint32_t load_big_endian(const uint8_t *bytes)
Load a message word safely even when input is unaligned.
Definition sha256fst.c:51
static uint32_t rotate_right(uint32_t value, unsigned count)
Rotate a 32-bit word without signed arithmetic.
Definition sha256fst.c:40
void sha256_finalize_bytes(struct sha256 *context, void *output)
Finish a message and write its standard big-endian digest bytes.
Definition sha256fst.c:262
static uint32_t schedule_sigma_one(uint32_t value)
Lowercase sigma-1 for expansion of the message schedule.
Definition sha256fst.c:72
Allocation-free, portable SHA-256 checksums for memory and streams.
#define SHA256_BLOCK_SIZE
Number of input bytes in one SHA-256 compression block.
Definition sha256fst.h:45
#define SHA256_HEX_SIZE
Required hexadecimal output capacity, including the trailing NUL.
Definition sha256fst.h:47