![]() |
QPMS
Electromagnetic multiple scattering library and toolkit.
|
Self-contained SHA-256 (FIPS 180-4) for content fingerprints. More...
#include <stddef.h>#include <stdint.h>

Go to the source code of this file.
Data Structures | |
| struct | qpms_sha256_t |
| Incremental SHA-256 state. More... | |
Functions | |
| void | qpms_sha256_init (qpms_sha256_t *ctx) |
| Initialises the hash state. | |
| void | qpms_sha256_update (qpms_sha256_t *ctx, const void *data, size_t len) |
| Feeds len bytes into the hash. | |
| void | qpms_sha256_final (qpms_sha256_t *ctx, uint8_t out[32]) |
| Finishes the hash and writes the 32-byte digest to out. | |
| void | qpms_sha256_hex (char hex[65], const void *data, size_t len) |
| One-shot SHA-256 of a buffer. | |
| int | qpms_sha256_file_hex (char hex[65], const char *path) |
| One-shot SHA-256 of a whole file. | |
Self-contained SHA-256 (FIPS 180-4) for content fingerprints.
Used e.g. by the scatspec/simspec fingerprint helpers (system provenance and append-reuse checks in the results container); deliberately free of external dependencies.
| int qpms_sha256_file_hex | ( | char | hex[65], |
| const char * | path | ||
| ) |
One-shot SHA-256 of a whole file.
Writes 64 lowercase hex characters plus the terminating NUL into hex (which must have room for 65 bytes).
| void qpms_sha256_final | ( | qpms_sha256_t * | ctx, |
| uint8_t | out[32] | ||
| ) |
Finishes the hash and writes the 32-byte digest to out.
The context is left unspecified afterwards.
| void qpms_sha256_hex | ( | char | hex[65], |
| const void * | data, | ||
| size_t | len | ||
| ) |
One-shot SHA-256 of a buffer.
Writes 64 lowercase hex characters plus the terminating NUL into hex (which must have room for 65 bytes).