Skip to main content
Version: 0.2.1

BLAKE2

Types

noxtls_blake2_ctx_t

Opaque context for incremental BLAKE2s or BLAKE2b hashing. Used by noxtls_blake2s_256_init / noxtls_blake2b_512_init, noxtls_blake2_update, noxtls_blake2_finish. Allocate and pass to the appropriate init; do not access fields directly.

API

noxtls_blake2s_256_init

noxtls_return_t noxtls_blake2s_256_init(noxtls_blake2_ctx_t * ctx);

Initialize BLAKE2s for a 256-bit (32-byte) digest (RFC 7693).

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL.

noxtls_blake2b_512_init

noxtls_return_t noxtls_blake2b_512_init(noxtls_blake2_ctx_t * ctx);

Initialize BLAKE2b for a 512-bit (64-byte) digest (RFC 7693).

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL.

noxtls_blake2_update

noxtls_return_t noxtls_blake2_update(noxtls_blake2_ctx_t * ctx, const uint8_t * data, uint32_t len);

Feed data into the BLAKE2 (BLAKE2s or BLAKE2b) hash.

Parameters:

Returns: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL or data is NULL with len non-zero.

noxtls_blake2_finish

noxtls_return_t noxtls_blake2_finish(noxtls_blake2_ctx_t * ctx, uint8_t * hash);

Finalize BLAKE2 and write the digest.

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx or hash is NULL.