libhasha 2.2.2
|
Header file for SHA-2 cryptographic hash functions. More...
#include "internal/internal.h"
Go to the source code of this file.
Classes | |
struct | ha_sha2_224_context |
Context structure for SHA-2 224-bit hashing. More... | |
struct | ha_sha2_256_context |
Context structure for SHA-2 256-bit hashing. More... | |
struct | ha_sha2_384_context |
Context structure for SHA-2 384-bit hashing. More... | |
struct | ha_sha2_512_context |
Context structure for SHA-2 512-bit hashing. More... | |
struct | ha_sha2_512_224_context |
Context structure for SHA-2 512-224-bit hashing. More... | |
struct | ha_sha2_512_256_context |
Context structure for SHA-2 512-256-bit hashing. More... |
Macros | |
#define | HA_SHA2_224_BLOCK_SIZE 64 |
The block size in bytes for the SHA-2 224-bit algorithm (64 bytes). | |
#define | HA_SHA2_224_DIGEST_SIZE ha_bB(224) |
The digest size in bytes for the SHA-2 224-bit algorithm (28 bytes). | |
#define | HA_SHA2_256_BLOCK_SIZE 64 |
The block size in bytes for the SHA-2 256-bit algorithm (64 bytes). | |
#define | HA_SHA2_256_DIGEST_SIZE ha_bB(256) |
The digest size in bytes for the SHA-2 256-bit algorithm (32 bytes). | |
#define | HA_SHA2_384_BLOCK_SIZE 128 |
The block size in bytes for the SHA-2 384-bit algorithm (128 bytes). | |
#define | HA_SHA2_384_DIGEST_SIZE ha_bB(384) |
The digest size in bytes for the SHA-2 384-bit algorithm (48 bytes). | |
#define | HA_SHA2_512_BLOCK_SIZE 128 |
The block size in bytes for the SHA-2 512-bit algorithm (128 bytes). | |
#define | HA_SHA2_512_DIGEST_SIZE ha_bB(512) |
The digest size in bytes for the SHA-2 512-bit algorithm (64 bytes). | |
#define | HA_SHA2_512_224_BLOCK_SIZE 128 |
The block size in bytes for the SHA-2 512-224 algorithm (128 bytes). | |
#define | HA_SHA2_512_224_DIGEST_SIZE ha_bB(224) |
The digest size in bytes for the SHA-2 512-224 algorithm (28 bytes). | |
#define | HA_SHA2_512_256_BLOCK_SIZE 128 |
The block size in bytes for the SHA-2 512-256 algorithm (128 bytes). | |
#define | HA_SHA2_512_256_DIGEST_SIZE ha_bB(256) |
The digest size in bytes for the SHA-2 512-256 algorithm (32 bytes). |
Typedefs | |
typedef struct ha_sha2_224_context | ha_sha2_224_context |
typedef struct ha_sha2_256_context | ha_sha2_256_context |
typedef struct ha_sha2_384_context | ha_sha2_384_context |
typedef struct ha_sha2_512_context | ha_sha2_512_context |
typedef struct ha_sha2_512_224_context | ha_sha2_512_224_context |
typedef struct ha_sha2_512_256_context | ha_sha2_512_256_context |
Functions | |
HA_PUBFUN void | ha_sha2_224_transform (ha_sha2_224_context *ctx, ha_inbuf_t data) |
Transforms the data in the SHA-2 224-bit context. | |
HA_PUBFUN void | ha_sha2_224_init (ha_sha2_224_context *ctx) |
Initializes the SHA-2 224-bit context. | |
HA_PUBFUN void | ha_sha2_224_update (ha_sha2_224_context *ctx, ha_inbuf_t data, size_t length) |
Updates the SHA-2 224-bit context with new data. | |
HA_PUBFUN void | ha_sha2_224_final (ha_sha2_224_context *ctx, ha_digest_t digest) |
Finalizes the SHA-2 224-bit computation and produces the hash digest. | |
HA_PUBFUN void | ha_sha2_224_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA-2 224-bit hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha2_256_transform (ha_sha2_256_context *ctx, ha_inbuf_t data) |
Transforms the data in the SHA-2 256-bit context. | |
HA_PUBFUN void | ha_sha2_256_init (ha_sha2_256_context *ctx) |
Initializes the SHA-2 256-bit context. | |
HA_PUBFUN void | ha_sha2_256_update (ha_sha2_256_context *ctx, ha_inbuf_t data, size_t length) |
Updates the SHA-2 256-bit context with new data. | |
HA_PUBFUN void | ha_sha2_256_final (ha_sha2_256_context *ctx, ha_digest_t digest) |
Finalizes the SHA-2 256-bit computation and produces the hash digest. | |
HA_PUBFUN void | ha_sha2_256_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA-2 256-bit hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha2_384_transform (ha_sha2_384_context *ctx, ha_inbuf_t data) |
Transforms the data in the SHA-2 384-bit context. | |
HA_PUBFUN void | ha_sha2_384_init (ha_sha2_384_context *ctx) |
Initializes the SHA-2 384-bit context. | |
HA_PUBFUN void | ha_sha2_384_update (ha_sha2_384_context *ctx, ha_inbuf_t data, size_t length) |
Updates the SHA-2 384-bit context with new data. | |
HA_PUBFUN void | ha_sha2_384_final (ha_sha2_384_context *ctx, ha_digest_t digest) |
Finalizes the SHA-2 384-bit computation and produces the hash digest. | |
HA_PUBFUN void | ha_sha2_384_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA-2 384-bit hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha2_512_transform (ha_sha2_512_context *ctx, ha_inbuf_t data) |
Transforms the data in the SHA-2 512-bit context. | |
HA_PUBFUN void | ha_sha2_512_init (ha_sha2_512_context *ctx) |
Initializes the SHA-2 512-bit context. | |
HA_PUBFUN void | ha_sha2_512_update (ha_sha2_512_context *ctx, ha_inbuf_t data, size_t length) |
Updates the SHA-2 512-bit context with new data. | |
HA_PUBFUN void | ha_sha2_512_final (ha_sha2_512_context *ctx, ha_digest_t digest) |
Finalizes the SHA-2 512-bit computation and produces the hash digest. | |
HA_PUBFUN void | ha_sha2_512_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA-2 512-bit hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha2_512_224_transform (ha_sha2_512_224_context *ctx, ha_inbuf_t data) |
Transforms the data in the SHA-2 512-224-bit context. | |
HA_PUBFUN void | ha_sha2_512_224_init (ha_sha2_512_224_context *ctx) |
Initializes the SHA-2 512-224-bit context. | |
HA_PUBFUN void | ha_sha2_512_224_update (ha_sha2_512_224_context *ctx, ha_inbuf_t data, size_t length) |
Updates the SHA-2 512-224-bit context with new data. | |
HA_PUBFUN void | ha_sha2_512_224_final (ha_sha2_512_224_context *ctx, ha_digest_t digest) |
Finalizes the SHA-2 512-224-bit computation and produces the hash digest. | |
HA_PUBFUN void | ha_sha2_512_224_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA-2 512-224-bit hash in a one-shot operation. | |
HA_PUBFUN void | ha_sha2_512_256_transform (ha_sha2_512_256_context *ctx, ha_inbuf_t data) |
Transforms the data in the SHA-2 512-256-bit context. | |
HA_PUBFUN void | ha_sha2_512_256_init (ha_sha2_512_256_context *ctx) |
Initializes the SHA-2 512-256-bit context. | |
HA_PUBFUN void | ha_sha2_512_256_update (ha_sha2_512_256_context *ctx, ha_inbuf_t data, size_t length) |
Updates the SHA-2 512-256-bit context with new data. | |
HA_PUBFUN void | ha_sha2_512_256_final (ha_sha2_512_256_context *ctx, ha_digest_t digest) |
Finalizes the SHA-2 512-256-bit computation and produces the hash digest. | |
HA_PUBFUN void | ha_sha2_512_256_hash (ha_inbuf_t data, size_t length, ha_digest_t digest) |
Computes the SHA-2 512-256-bit hash in a one-shot operation. |
Header file for SHA-2 cryptographic hash functions.
This header file defines the interface for the SHA-2 family of hash algorithms, including SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, and SHA-512/256.
It provides macro definitions for block and digest sizes, context structures for maintaining the hash state, and declarations for functions that perform the core transformations, initialization, updating, finalization, and one-shot hash computations. The implementation adheres to the standards specified in FIPS 180-4.
Definition in file sha2.h.
#define HA_SHA2_224_BLOCK_SIZE 64 |
#define HA_SHA2_224_DIGEST_SIZE ha_bB(224) |
#define HA_SHA2_256_BLOCK_SIZE 64 |
#define HA_SHA2_256_DIGEST_SIZE ha_bB(256) |
#define HA_SHA2_384_BLOCK_SIZE 128 |
#define HA_SHA2_384_DIGEST_SIZE ha_bB(384) |
#define HA_SHA2_512_224_BLOCK_SIZE 128 |
#define HA_SHA2_512_224_DIGEST_SIZE ha_bB(224) |
#define HA_SHA2_512_256_BLOCK_SIZE 128 |
#define HA_SHA2_512_256_DIGEST_SIZE ha_bB(256) |
#define HA_SHA2_512_BLOCK_SIZE 128 |
#define HA_SHA2_512_DIGEST_SIZE ha_bB(512) |
typedef struct ha_sha2_224_context ha_sha2_224_context |
typedef struct ha_sha2_256_context ha_sha2_256_context |
typedef struct ha_sha2_384_context ha_sha2_384_context |
typedef struct ha_sha2_512_224_context ha_sha2_512_224_context |
typedef struct ha_sha2_512_256_context ha_sha2_512_256_context |
typedef struct ha_sha2_512_context ha_sha2_512_context |
HA_PUBFUN void ha_sha2_224_final | ( | ha_sha2_224_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA-2 224-bit computation and produces the hash digest.
This function finals the SHA-2 224-bit hash calculation and outputs the resulting digest into the provided buffer.
ctx | Pointer to the SHA-2 224-bit context structure. |
digest | Pointer to the output buffer to store the final SHA-2 224-bit digest (28 bytes). |
HA_PUBFUN void ha_sha2_224_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA-2 224-bit hash in a one-shot operation.
This function computes the SHA-2 224-bit hash of the provided data in a single call. It initializes, updates, and finals the SHA-2 224-bit computation 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 SHA-2 224-bit digest (28 bytes). |
HA_PUBFUN void ha_sha2_224_init | ( | ha_sha2_224_context * | ctx | ) |
Initializes the SHA-2 224-bit context.
This function initializes the SHA-2 224-bit context to start a new hash computation.
ctx | Pointer to the SHA-2 224-bit context structure to initialize. |
HA_PUBFUN void ha_sha2_224_transform | ( | ha_sha2_224_context * | ctx, |
ha_inbuf_t | data ) |
Transforms the data in the SHA-2 224-bit context.
This function performs the transformation step of the SHA-2 224-bit hash computation. It processes the input data block and updates the internal state of the context.
ctx | Pointer to the SHA-2 224-bit context structure. |
data | Pointer to the input data block (64 bytes). |
HA_PUBFUN void ha_sha2_224_update | ( | ha_sha2_224_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the SHA-2 224-bit context with new data.
This function processes the provided data and updates the SHA-2 224-bit context state.
ctx | Pointer to the SHA-2 224-bit context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha2_256_final | ( | ha_sha2_256_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA-2 256-bit computation and produces the hash digest.
This function finals the SHA-2 256-bit hash calculation and outputs the resulting digest into the provided buffer.
ctx | Pointer to the SHA-2 256-bit context structure. |
digest | Pointer to the output buffer to store the final SHA-2 256-bit digest (32 bytes). |
HA_PUBFUN void ha_sha2_256_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA-2 256-bit hash in a one-shot operation.
This function computes the SHA-2 256-bit hash of the provided data in a single call. It initializes, updates, and finals the SHA-2 256-bit computation 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 SHA-2 256-bit digest (32 bytes). |
HA_PUBFUN void ha_sha2_256_init | ( | ha_sha2_256_context * | ctx | ) |
Initializes the SHA-2 256-bit context.
This function initializes the SHA-2 256-bit context to start a new hash computation.
ctx | Pointer to the SHA-2 256-bit context structure to initialize. |
HA_PUBFUN void ha_sha2_256_transform | ( | ha_sha2_256_context * | ctx, |
ha_inbuf_t | data ) |
Transforms the data in the SHA-2 256-bit context.
This function performs the transformation step of the SHA-2 256-bit hash computation. It processes the input data block and updates the internal state of the context.
ctx | Pointer to the SHA-2 256-bit context structure. |
data | Pointer to the input data block (64 bytes). |
HA_PUBFUN void ha_sha2_256_update | ( | ha_sha2_256_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the SHA-2 256-bit context with new data.
This function processes the provided data and updates the SHA-2 256-bit context state.
ctx | Pointer to the SHA-2 256-bit context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha2_384_final | ( | ha_sha2_384_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA-2 384-bit computation and produces the hash digest.
This function finals the SHA-2 384-bit hash calculation and outputs the resulting digest into the provided buffer.
ctx | Pointer to the SHA-2 384-bit context structure. |
digest | Pointer to the output buffer to store the final SHA-2 384-bit digest (48 bytes). |
HA_PUBFUN void ha_sha2_384_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA-2 384-bit hash in a one-shot operation.
This function computes the SHA-2 384-bit hash of the provided data in a single call. It initializes, updates, and finals the SHA-2 384-bit computation 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 SHA-2 384-bit digest (48 bytes). |
HA_PUBFUN void ha_sha2_384_init | ( | ha_sha2_384_context * | ctx | ) |
Initializes the SHA-2 384-bit context.
This function initializes the SHA-2 384-bit context to start a new hash computation.
ctx | Pointer to the SHA-2 384-bit context structure to initialize. |
HA_PUBFUN void ha_sha2_384_transform | ( | ha_sha2_384_context * | ctx, |
ha_inbuf_t | data ) |
Transforms the data in the SHA-2 384-bit context.
This function performs the transformation step of the SHA-2 384-bit hash computation. It processes the input data block and updates the internal state of the context.
ctx | Pointer to the SHA-2 384-bit context structure. |
data | Pointer to the input data block (128 bytes). |
HA_PUBFUN void ha_sha2_384_update | ( | ha_sha2_384_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the SHA-2 384-bit context with new data.
This function processes the provided data and updates the SHA-2 384-bit context state.
ctx | Pointer to the SHA-2 384-bit context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha2_512_224_final | ( | ha_sha2_512_224_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA-2 512-224-bit computation and produces the hash digest.
This function finals the SHA-2 512-224-bit hash calculation and outputs the resulting digest into the provided buffer.
ctx | Pointer to the SHA-2 512-224-bit context structure. |
digest | Pointer to the output buffer to store the final SHA-2 512-224-bit digest (28 bytes). |
HA_PUBFUN void ha_sha2_512_224_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA-2 512-224-bit hash in a one-shot operation.
This function computes the SHA-2 512-224-bit hash of the provided data in a single call. It initializes, updates, and finals the SHA-2 512-224-bit computation 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 SHA-2 512-224-bit digest (28 bytes). |
HA_PUBFUN void ha_sha2_512_224_init | ( | ha_sha2_512_224_context * | ctx | ) |
Initializes the SHA-2 512-224-bit context.
This function initializes the SHA-2 512-224-bit context to start a new hash computation.
ctx | Pointer to the SHA-2 512-224-bit context structure to initialize. |
HA_PUBFUN void ha_sha2_512_224_transform | ( | ha_sha2_512_224_context * | ctx, |
ha_inbuf_t | data ) |
Transforms the data in the SHA-2 512-224-bit context.
This function performs the transformation step of the SHA-2 512-224-bit hash computation. It processes the input data block and updates the internal state of the context.
ctx | Pointer to the SHA-2 512-224-bit context structure. |
data | Pointer to the input data block (128 bytes). |
HA_PUBFUN void ha_sha2_512_224_update | ( | ha_sha2_512_224_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the SHA-2 512-224-bit context with new data.
This function processes the provided data and updates the SHA-2 512-224-bit context state.
ctx | Pointer to the SHA-2 512-224-bit context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha2_512_256_final | ( | ha_sha2_512_256_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA-2 512-256-bit computation and produces the hash digest.
This function finals the SHA-2 512-256-bit hash calculation and outputs the resulting digest into the provided buffer.
ctx | Pointer to the SHA-2 512-256-bit context structure. |
digest | Pointer to the output buffer to store the final SHA-2 512-256-bit digest (32 bytes). |
HA_PUBFUN void ha_sha2_512_256_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA-2 512-256-bit hash in a one-shot operation.
This function computes the SHA-2 512-256-bit hash of the provided data in a single call. It initializes, updates, and finals the SHA-2 512-256-bit computation 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 SHA-2 512-256-bit digest (32 bytes). |
HA_PUBFUN void ha_sha2_512_256_init | ( | ha_sha2_512_256_context * | ctx | ) |
Initializes the SHA-2 512-256-bit context.
This function initializes the SHA-2 512-256-bit context to start a new hash computation.
ctx | Pointer to the SHA-2 512-256-bit context structure to initialize. |
HA_PUBFUN void ha_sha2_512_256_transform | ( | ha_sha2_512_256_context * | ctx, |
ha_inbuf_t | data ) |
Transforms the data in the SHA-2 512-256-bit context.
This function performs the transformation step of the SHA-2 512-256-bit hash computation. It processes the input data block and updates the internal state of the context.
ctx | Pointer to the SHA-2 512-256-bit context structure. |
data | Pointer to the input data block (128 bytes). |
HA_PUBFUN void ha_sha2_512_256_update | ( | ha_sha2_512_256_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the SHA-2 512-256-bit context with new data.
This function processes the provided data and updates the SHA-2 512-256-bit context state.
ctx | Pointer to the SHA-2 512-256-bit context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |
HA_PUBFUN void ha_sha2_512_final | ( | ha_sha2_512_context * | ctx, |
ha_digest_t | digest ) |
Finalizes the SHA-2 512-bit computation and produces the hash digest.
This function finals the SHA-2 512-bit hash calculation and outputs the resulting digest into the provided buffer.
ctx | Pointer to the SHA-2 512-bit context structure. |
digest | Pointer to the output buffer to store the final SHA-2 512-bit digest (64 bytes). |
HA_PUBFUN void ha_sha2_512_hash | ( | ha_inbuf_t | data, |
size_t | length, | ||
ha_digest_t | digest ) |
Computes the SHA-2 512-bit hash in a one-shot operation.
This function computes the SHA-2 512-bit hash of the provided data in a single call. It initializes, updates, and finals the SHA-2 512-bit computation 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 SHA-2 512-bit digest (64 bytes). |
HA_PUBFUN void ha_sha2_512_init | ( | ha_sha2_512_context * | ctx | ) |
Initializes the SHA-2 512-bit context.
This function initializes the SHA-2 512-bit context to start a new hash computation.
ctx | Pointer to the SHA-2 512-bit context structure to initialize. |
HA_PUBFUN void ha_sha2_512_transform | ( | ha_sha2_512_context * | ctx, |
ha_inbuf_t | data ) |
Transforms the data in the SHA-2 512-bit context.
This function performs the transformation step of the SHA-2 512-bit hash computation. It processes the input data block and updates the internal state of the context.
ctx | Pointer to the SHA-2 512-bit context structure. |
data | Pointer to the input data block (128 bytes). |
HA_PUBFUN void ha_sha2_512_update | ( | ha_sha2_512_context * | ctx, |
ha_inbuf_t | data, | ||
size_t | length ) |
Updates the SHA-2 512-bit context with new data.
This function processes the provided data and updates the SHA-2 512-bit context state.
ctx | Pointer to the SHA-2 512-bit context structure. |
data | Pointer to the input data to process. |
length | Length of the input data in bytes. |