libhasha 2.2.2
|
Header file for SHA3 cryptographic hash functions. More...
#include "internal/internal.h"
Go to the source code of this file.
Macros | |
#define | HA_SHA3_224_DIGEST_SIZE ha_bB(224) |
The digest size (in bytes) for the SHA3-224 algorithm (224 bits). | |
#define | HA_SHA3_256_DIGEST_SIZE ha_bB(256) |
The digest size (in bytes) for the SHA3-256 algorithm (256 bits). | |
#define | HA_SHA3_384_DIGEST_SIZE ha_bB(384) |
The digest size (in bytes) for the SHA3-384 algorithm (384 bits). | |
#define | HA_SHA3_512_DIGEST_SIZE ha_bB(512) |
The digest size (in bytes) for the SHA3-512 algorithm (512 bits). |
Typedefs | |
typedef struct ha_keccak_context | ha_sha3_context |
typedef ha_sha3_context | ha_sha3_224_context |
typedef ha_sha3_context | ha_sha3_256_context |
typedef ha_sha3_context | ha_sha3_384_context |
typedef ha_sha3_context | ha_sha3_512_context |
Functions | |
HA_PUBFUN void | ha_sha3_224_init (ha_sha3_224_context *ctx) |
Initializes the SHA3-224 context. | |
HA_PUBFUN void | ha_sha3_224_update (ha_sha3_224_context *ctx, ha_inbuf_t data, size_t length) |
Absorbs data into the SHA3-224 context. | |
HA_PUBFUN void | ha_sha3_224_final (ha_sha3_224_context *ctx, ha_digest_t digest) |
Finalizes the SHA3-224 computation. | |
HA_PUBFUN void | ha_sha3_224_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA3-224 hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha3_256_init (ha_sha3_256_context *ctx) |
Initializes the SHA3-256 context. | |
HA_PUBFUN void | ha_sha3_256_update (ha_sha3_256_context *ctx, ha_inbuf_t data, size_t length) |
Absorbs data into the SHA3-256 context. | |
HA_PUBFUN void | ha_sha3_256_final (ha_sha3_256_context *ctx, ha_digest_t digest) |
Finalizes the SHA3-256 computation. | |
HA_PUBFUN void | ha_sha3_256_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA3-256 hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha3_384_init (ha_sha3_384_context *ctx) |
Initializes the SHA3-384 context. | |
HA_PUBFUN void | ha_sha3_384_update (ha_sha3_384_context *ctx, ha_inbuf_t data, size_t length) |
Absorbs data into the SHA3-384 context. | |
HA_PUBFUN void | ha_sha3_384_final (ha_sha3_384_context *ctx, ha_digest_t digest) |
Finalizes the SHA3-384 computation. | |
HA_PUBFUN void | ha_sha3_384_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA3-384 hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha3_512_init (ha_sha3_512_context *ctx) |
Initializes the SHA3-512 context. | |
HA_PUBFUN void | ha_sha3_512_update (ha_sha3_512_context *ctx, ha_inbuf_t data, size_t length) |
Absorbs data into the SHA3-512 context. | |
HA_PUBFUN void | ha_sha3_512_final (ha_sha3_512_context *ctx, ha_digest_t digest) |
Finalizes the SHA3-512 computation. | |
HA_PUBFUN void | ha_sha3_512_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA3-512 hash in a one-shot operation. |
Header file for SHA3 cryptographic hash functions.
This header file defines the interface for the SHA3 family of hash functions, including SHA3-224, SHA3-256, SHA3-384, and SHA3-512. It provides macro definitions for the rate and digest sizes of each variant, a common context structure for holding the internal state during the hashing process, and function declarations for initializing, absorbing data, finalizing, squeezing the digest, and performing one-shot hash computations.
The SHA3 functions utilize the Keccak-f[1600] permutation (see keccak1600.h) as the core transformation. The library processes input data in chunks and generates a hash digest according to the variant's specification.
Definition in file sha3.h.
#define HA_SHA3_224_DIGEST_SIZE ha_bB(224) |
#define HA_SHA3_256_DIGEST_SIZE ha_bB(256) |
#define HA_SHA3_384_DIGEST_SIZE ha_bB(384) |
#define HA_SHA3_512_DIGEST_SIZE ha_bB(512) |
typedef ha_sha3_context ha_sha3_224_context |
typedef ha_sha3_context ha_sha3_256_context |
typedef ha_sha3_context ha_sha3_384_context |
typedef ha_sha3_context ha_sha3_512_context |
typedef struct ha_keccak_context ha_sha3_context |
HA_PUBFUN void ha_sha3_224_final | ( | ha_sha3_224_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA3-224 computation.
This function finals the SHA3-224 hash calculation.
ctx | Pointer to the SHA3-224 context structure. |
digest | Pointer to the output buffer where the final hash will be stored. |
HA_PUBFUN void ha_sha3_224_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA3-224 hash in a one-shot operation.
This function computes the SHA3-224 hash of the provided data in a single call. It initializes, absorbs, finals, and squeezes the result internally.
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
digest | Pointer to the output buffer to store the final SHA3-224 digest. |
HA_PUBFUN void ha_sha3_224_init | ( | ha_sha3_224_context * | ctx | ) |
Initializes the SHA3-224 context.
This function initializes the SHA3-224 context to start a new hash computation.
ctx | Pointer to the SHA3-224 context structure to initialize. |
HA_PUBFUN void ha_sha3_224_update | ( | ha_sha3_224_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Absorbs data into the SHA3-224 context.
This function processes the provided data and updates the SHA3-224 context state.
ctx | Pointer to the SHA3-224 context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha3_256_final | ( | ha_sha3_256_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA3-256 computation.
This function finals the SHA3-256 hash calculation.
ctx | Pointer to the SHA3-256 context structure. |
digest | Pointer to the output buffer where the final hash will be stored. |
HA_PUBFUN void ha_sha3_256_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA3-256 hash in a one-shot operation.
This function computes the SHA3-256 hash of the provided data in a single call. It initializes, absorbs, finals, and squeezes the result internally.
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
digest | Pointer to the output buffer to store the final SHA3-256 digest. |
HA_PUBFUN void ha_sha3_256_init | ( | ha_sha3_256_context * | ctx | ) |
Initializes the SHA3-256 context.
This function initializes the SHA3-256 context to start a new hash computation.
ctx | Pointer to the SHA3-256 context structure to initialize. |
HA_PUBFUN void ha_sha3_256_update | ( | ha_sha3_256_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Absorbs data into the SHA3-256 context.
This function processes the provided data and updates the SHA3-256 context state.
ctx | Pointer to the SHA3-256 context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha3_384_final | ( | ha_sha3_384_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA3-384 computation.
This function finals the SHA3-384 hash calculation.
ctx | Pointer to the SHA3-384 context structure. |
digest | Pointer to the output buffer where the final hash will be stored. |
HA_PUBFUN void ha_sha3_384_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA3-384 hash in a one-shot operation.
This function computes the SHA3-384 hash of the provided data in a single call. It initializes, absorbs, finals, and squeezes the result internally.
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
digest | Pointer to the output buffer to store the final SHA3-384 digest. |
HA_PUBFUN void ha_sha3_384_init | ( | ha_sha3_384_context * | ctx | ) |
Initializes the SHA3-384 context.
This function initializes the SHA3-384 context to start a new hash computation.
ctx | Pointer to the SHA3-384 context structure to initialize. |
HA_PUBFUN void ha_sha3_384_update | ( | ha_sha3_384_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Absorbs data into the SHA3-384 context.
This function processes the provided data and updates the SHA3-384 context state.
ctx | Pointer to the SHA3-384 context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha3_512_final | ( | ha_sha3_512_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA3-512 computation.
This function finals the SHA3-512 hash calculation.
ctx | Pointer to the SHA3-512 context structure. |
digest | Pointer to the output buffer where the final hash will be stored. |
HA_PUBFUN void ha_sha3_512_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA3-512 hash in a one-shot operation.
This function computes the SHA3-512 hash of the provided data in a single call. It initializes, absorbs, finals, and squeezes the result internally.
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
digest | Pointer to the output buffer to store the final SHA3-512 digest. |
HA_PUBFUN void ha_sha3_512_init | ( | ha_sha3_512_context * | ctx | ) |
Initializes the SHA3-512 context.
This function initializes the SHA3-512 context to start a new hash computation.
ctx | Pointer to the SHA3-512 context structure to initialize. |
HA_PUBFUN void ha_sha3_512_update | ( | ha_sha3_512_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Absorbs data into the SHA3-512 context.
This function processes the provided data and updates the SHA3-512 context state.
ctx | Pointer to the SHA3-512 context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |