sha3
Embeddable C11 SHA-3 implementation.
|
Cryptographic hash functions with fixed-length output, as defined in section 6.1 of FIPS 202. More...
Data Structures | |
union | sha3_state_t |
Internal SHA-3 state (all members are private). More... | |
struct | sha3_t |
Iterative SHA-3 context (all members are private). More... | |
Functions | |
void | sha3_224 (const uint8_t *src, size_t len, uint8_t dst[static 28]) |
Calculate SHA3-224 hash of input data. More... | |
void | sha3_224_init (sha3_t *hash) |
Initialize SHA3-224 hash context. More... | |
_Bool | sha3_224_absorb (sha3_t *hash, const uint8_t *src, const size_t len) |
Initialize SHA3-224 hash context. More... | |
void | sha3_224_final (sha3_t *hash, uint8_t dst[28]) |
Finalize SHA3-224 hash context and write 28 bytes of output to destination buffer dst . More... | |
void | sha3_256 (const uint8_t *src, size_t len, uint8_t dst[static 32]) |
Calculate SHA3-256 hash of input data. More... | |
void | sha3_256_init (sha3_t *hash) |
Initialize SHA3-256 hash context. More... | |
_Bool | sha3_256_absorb (sha3_t *hash, const uint8_t *src, const size_t len) |
Absorb input data into SHA3-256 hash context. More... | |
void | sha3_256_final (sha3_t *hash, uint8_t dst[32]) |
Finalize SHA3-256 hash context and write 32 bytes of output to destination buffer dst . More... | |
void | sha3_384 (const uint8_t *src, size_t len, uint8_t dst[static 48]) |
Calculate SHA3-384 hash of input data. More... | |
void | sha3_384_init (sha3_t *hash) |
Initialize SHA3-384 hash context. More... | |
_Bool | sha3_384_absorb (sha3_t *hash, const uint8_t *src, const size_t len) |
Absorb input data into SHA3-384 hash context. More... | |
void | sha3_384_final (sha3_t *hash, uint8_t dst[48]) |
Finalize SHA3-384 hash context and write 48 bytes of output to destination buffer dst . More... | |
void | sha3_512 (const uint8_t *src, size_t len, uint8_t dst[static 64]) |
Calculate SHA3-512 hash of input data. More... | |
void | sha3_512_init (sha3_t *hash) |
Initialize SHA3-512 hash context. More... | |
_Bool | sha3_512_absorb (sha3_t *hash, const uint8_t *src, const size_t len) |
Absorb input data into SHA3-512 hash context. More... | |
void | sha3_512_final (sha3_t *hash, uint8_t dst[64]) |
Finalize SHA3-512 hash context and write 64 bytes of output to destination buffer dst . More... | |
Cryptographic hash functions with fixed-length output, as defined in section 6.1 of FIPS 202.
void sha3_224 | ( | const uint8_t * | src, |
size_t | len, | ||
uint8_t | dst[static 28] | ||
) |
Calculate SHA3-224 hash of input data.
Hash len
bytes of input data from source buffer src
with SHA3-224 (FIPS 202, section 6.1), then write 28 bytes of output to destination buffer dst
.
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. Must be at least 28 bytes in length. |
Example:
_Bool sha3_224_absorb | ( | sha3_t * | hash, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Initialize SHA3-224 hash context.
Absorb len
bytes of input data from source buffer src
into SHA3-224 hash context hash
. Can be called iteratively to absorb input data in chunks.
[in,out] | hash | SHA3-224 hash context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void sha3_224_final | ( | sha3_t * | hash, |
uint8_t | dst[28] | ||
) |
Finalize SHA3-224 hash context and write 28 bytes of output to destination buffer dst
.
[in,out] | hash | SHA3-224 hash context. |
[out] | dst | Destination buffer. Must be at least 28 bytes in length. |
Example:
void sha3_224_init | ( | sha3_t * | hash | ) |
Initialize SHA3-224 hash context.
[out] | hash | SHA3-224 hash context. |
Example:
void sha3_256 | ( | const uint8_t * | src, |
size_t | len, | ||
uint8_t | dst[static 32] | ||
) |
Calculate SHA3-256 hash of input data.
Hash len
bytes of input data from source buffer src
with SHA3-256 (FIPS 202, section 6.1), then write 32 bytes of output to destination buffer dst
.
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. Must be at least 32 bytes in length. |
Example:
_Bool sha3_256_absorb | ( | sha3_t * | hash, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb input data into SHA3-256 hash context.
Absorb len
bytes of input data from source buffer src
into SHA3-256 hash context hash
. Can be called iteratively to absorb input data in chunks.
[in,out] | hash | SHA3-256 hash context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void sha3_256_final | ( | sha3_t * | hash, |
uint8_t | dst[32] | ||
) |
Finalize SHA3-256 hash context and write 32 bytes of output to destination buffer dst
.
[in,out] | hash | SHA3-256 hash context. |
[out] | dst | Destination buffer. Must be at least 32 bytes in length. |
Example:
void sha3_256_init | ( | sha3_t * | hash | ) |
Initialize SHA3-256 hash context.
[out] | hash | SHA3-256 hash context. |
Example:
void sha3_384 | ( | const uint8_t * | src, |
size_t | len, | ||
uint8_t | dst[static 48] | ||
) |
Calculate SHA3-384 hash of input data.
Hash len
bytes of input data from source buffer src
with SHA3-384 (FIPS 202, section 6.1), then write 48 bytes of output to destination buffer dst
.
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. Must be at least 48 bytes in length. |
Example:
_Bool sha3_384_absorb | ( | sha3_t * | hash, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb input data into SHA3-384 hash context.
Absorb len
bytes of input data from source buffer src
into SHA3-384 hash context hash
. Can be called iteratively to absorb input data in chunks.
[in,out] | hash | SHA3-384 hash context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void sha3_384_final | ( | sha3_t * | hash, |
uint8_t | dst[48] | ||
) |
Finalize SHA3-384 hash context and write 48 bytes of output to destination buffer dst
.
[in,out] | hash | SHA3-384 hash context. |
[out] | dst | Destination buffer. Must be at least 48 bytes in length. |
Example:
void sha3_384_init | ( | sha3_t * | hash | ) |
Initialize SHA3-384 hash context.
[out] | hash | SHA3-384 hash context. |
Example:
void sha3_512 | ( | const uint8_t * | src, |
size_t | len, | ||
uint8_t | dst[static 64] | ||
) |
Calculate SHA3-512 hash of input data.
Hash len
bytes of input data from source buffer src
with SHA3-512 (FIPS 202, section 6.1), then write 64 bytes of output to destination buffer dst
.
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. Must be at least 64 bytes in length. |
Example:
_Bool sha3_512_absorb | ( | sha3_t * | hash, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb input data into SHA3-512 hash context.
Absorb len
bytes of input data from source buffer src
into SHA3-512 hash context hash
. Can be called iteratively to absorb input data in chunks.
[in,out] | hash | SHA3-512 hash context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void sha3_512_final | ( | sha3_t * | hash, |
uint8_t | dst[64] | ||
) |
Finalize SHA3-512 hash context and write 64 bytes of output to destination buffer dst
.
[in,out] | hash | SHA3-512 hash context. |
[out] | dst | Destination buffer. Must be at least 64 bytes in length. |
Example:
void sha3_512_init | ( | sha3_t * | hash | ) |
Initialize SHA3-512 hash context.
[out] | hash | SHA3-512 hash context. |
Example: