|
ginnOS
The reference: libc, the libraries and the kernel
|
SHA-256 (FIPS 180-4) in steps, for data that does not fit in memory at one time. More...
Go to the source code of this file.
Data Structures | |
| struct | SHA2_CTX |
| the state of a SHA-256 calculation. More... | |
Macros | |
| #define | SHA256_BLOCK_LENGTH 64 |
| #define | SHA256_DIGEST_LENGTH 32 |
| #define | SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) |
Functions | |
| void | SHA256Init (SHA2_CTX *ctx) |
| start a new calculation in ctx. | |
| void | SHA256Update (SHA2_CTX *ctx, const void *data, size_t length) |
| add length bytes of data. | |
| void | SHA256Final (uint8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *ctx) |
| finish the calculation and write the digest. | |
SHA-256 (FIPS 180-4) in steps, for data that does not fit in memory at one time.
the names are the ones of the BSD sha2.h. ginnOS has SHA-256 only, not SHA-384 or SHA-512.
usage:
SHA2_CTX ctx; SHA256Init(&ctx); SHA256Update(&ctx, part, part_length); // as many times as needed SHA256Final(digest, &ctx);
for data in one buffer, sha256() in crypt.h does the three steps.
| #define SHA256_BLOCK_LENGTH 64 |
| #define SHA256_DIGEST_LENGTH 32 |
| #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) |
| void SHA256Init | ( | SHA2_CTX * | ctx | ) |
start a new calculation in ctx.