libhasha 2.2.2
|
Header file for the BLAKE3 hashing algorithm. More...
#include "internal/internal.h"
Go to the source code of this file.
Classes | |
struct | ha_blake3_context |
BLAKE3 hash state context. More... |
Typedefs | |
typedef HA_EXTERN_C_BEG struct ha_blake3_context | ha_blake3_context |
BLAKE3 hash state context. |
Functions | |
HA_PUBFUN void | ha_blake3_init (ha_blake3_context *ctx) |
Initializes the BLAKE3 context for hashing. | |
HA_PUBFUN void | ha_blake3_update (ha_blake3_context *ctx, ha_inbuf_t data, size_t length) |
Updates the BLAKE3 hash with more input data. | |
HA_PUBFUN void | ha_blake3_final (ha_blake3_context *ctx, ha_digest_t digest, size_t length) |
Finalizes the BLAKE3 hash and produces the final digest. | |
HA_PUBFUN void | ha_blake3_hash (ha_inbuf_t data, size_t length, ha_digest_t digest, size_t digest_length) |
Computes the BLAKE3 hash in a single operation. |
Header file for the BLAKE3 hashing algorithm.
This file provides the interface for the BLAKE3 cryptographic hash function, including the definition of the hash state context and function declarations for initializing, updating, finalizing, and computing the hash in a one-shot operation.
The BLAKE3 algorithm is designed for high performance and security, processing data in chunks and producing variable-length digests. This header is part of the libhasha library.
Definition in file blake3.h.
typedef HA_EXTERN_C_BEG struct ha_blake3_context ha_blake3_context |
BLAKE3 hash state context.
This structure holds the internal state of the BLAKE3 hashing algorithm. It includes buffers for input data, the current hash state, and other necessary variables for processing the data in chunks.
HA_PUBFUN void ha_blake3_final | ( | ha_blake3_context * | ctx, |
ha_digest_t | digest, | ||
size_t | length ) |
Finalizes the BLAKE3 hash and produces the final digest.
This function finishes the hash computation, producing the final digest from the data that has been passed to blake3_update. The length of the resulting digest is specified by the caller.
ctx | Pointer to the BLAKE3 context structure. |
digest | Pointer to a buffer where the resulting digest will be stored. |
length | The length of the digest to be produced, in bytes. |
HA_PUBFUN void ha_blake3_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest, | ||
size_t | digest_length ) |
Computes the BLAKE3 hash in a single operation.
This function combines the initialization, update, and finalization steps into a single call. It processes the input data and immediately produces the digest. This is a more convenient alternative when only a single input is available.
data | Pointer to the input data to be hashed. |
length | The length of the input data in bytes. |
digest | Pointer to a buffer where the resulting digest will be stored. |
digest_length | The length of the digest to be produced, in bytes. |
HA_PUBFUN void ha_blake3_init | ( | ha_blake3_context * | ctx | ) |
Initializes the BLAKE3 context for hashing.
This function sets up the initial state of the BLAKE3 context by clearing the internal state and preparing it to receive input data.
ctx | Pointer to a BLAKE3 context structure to be initialized. |
HA_PUBFUN void ha_blake3_update | ( | ha_blake3_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the BLAKE3 hash with more input data.
This function adds additional data to the ongoing hash computation. It can be called multiple times with chunks of data until all data has been processed.
ctx | Pointer to the BLAKE3 context structure. |
data | Pointer to the input data to be hashed. |
length | The length of the input data in bytes. |