sha3
Embeddable C11 SHA-3 implementation.
|
Keccak Message Authentication Code (MAC), as defined in section 4 of SP 800-185. More...
Data Structures | |
struct | kmac_params_t |
KMAC configuration parameters (key and customization string). More... | |
Functions | |
void | kmac128 (const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb data into KMAC128, then squeeze bytes out. More... | |
void | kmac256 (const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb data into KMAC256, then squeeze bytes out. More... | |
void | kmac128_xof_init (sha3_xof_t *xof, const kmac_params_t params) |
Initialize KMAC128 XOF context. More... | |
_Bool | kmac128_xof_absorb (sha3_xof_t *xof, const uint8_t *src, const size_t len) |
Absorb data into KMAC128 XOF context. More... | |
void | kmac128_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze data from KMAC128 XOF context. More... | |
void | kmac128_xof_once (const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb data into KMAC128 XOF context, then squeeze bytes out. More... | |
void | kmac256_xof_init (sha3_xof_t *xof, const kmac_params_t params) |
Initialize KMAC256 XOF context. More... | |
_Bool | kmac256_xof_absorb (sha3_xof_t *xof, const uint8_t *src, const size_t len) |
Absorb data into KMAC256 XOF context. More... | |
void | kmac256_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze data from KMAC256 XOF context. More... | |
void | kmac256_xof_once (const kmac_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb data into KMAC256 XOF context, then squeeze bytes out. More... | |
Keccak Message Authentication Code (MAC), as defined in section 4 of SP 800-185.
void kmac128 | ( | const kmac_params_t | params, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb data into KMAC128, then squeeze bytes out.
Initialize internal KMAC128 (Keccak Message Authentication Code, as defined in section 4 of NIST SP 800-185) context with configuration parameters params
, absorb data in buffer src
of length src_len
bytes into internal context, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | params | KMAC configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
_Bool kmac128_xof_absorb | ( | sha3_xof_t * | xof, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into KMAC128 XOF context.
Absorb data in buffer src
of length len
bytes into KMAC128 XOF context. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | KMAC128 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void kmac128_xof_init | ( | sha3_xof_t * | xof, |
const kmac_params_t | params | ||
) |
Initialize KMAC128 XOF context.
Initialize KMAC128 XOF (Keccak Message Authentication Code eXtendable Output Function, as defined in section 4.3.1 of NIST SP 800-185) context with configuration parameters params
.
[out] | xof | KMAC128 XOF context. |
[in] | params | KMAC configuration parameters. |
Example:
void kmac128_xof_once | ( | const kmac_params_t | params, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb data into KMAC128 XOF context, then squeeze bytes out.
Initialize internal KMAC128 XOF (Keccak Message Authentication Code eXtendable Output Function, as defined in section 4 of NIST SP 800-185) context with configuration parameters params
, absorb data in buffer src
of length src_len
bytes into internal context, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | params | KMAC configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
void kmac128_xof_squeeze | ( | sha3_xof_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze data from KMAC128 XOF context.
Squeeze len
bytes of output into destination buffer dst
from KMAC128 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | KMAC128 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example:
void kmac256 | ( | const kmac_params_t | params, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb data into KMAC256, then squeeze bytes out.
Initialize internal KMAC256 (Keccak Message Authentication Code, as defined in section 4 of NIST SP 800-185) context with configuration parameters params
, absorb data in buffer src
of length src_len
bytes into internal context, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | params | KMAC configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
_Bool kmac256_xof_absorb | ( | sha3_xof_t * | xof, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into KMAC256 XOF context.
Absorb data in buffer src
of length len
bytes into KMAC256 XOF context. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | KMAC256 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void kmac256_xof_init | ( | sha3_xof_t * | xof, |
const kmac_params_t | params | ||
) |
Initialize KMAC256 XOF context.
Initialize KMAC256 XOF (Keccak Message Authentication Code eXtendable Output Function, as defined in section 4.3.1 of NIST SP 800-185) context with configuration parameters params
.
[out] | xof | KMAC256 XOF context. |
[in] | params | KMAC configuration parameters. |
Example:
void kmac256_xof_once | ( | const kmac_params_t | params, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb data into KMAC256 XOF context, then squeeze bytes out.
Initialize internal KMAC256 XOF (Keccak Message Authentication Code eXtendable Output Function, as defined in section 4 of NIST SP 800-185) context with configuration parameters params
, absorb data in buffer src
of length src_len
bytes into internal context, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | params | KMAC configuration parameters. |
[in] | src | Source buffer. |
[in] | src_len | Source buffer length, in bytes. |
[out] | dst | Destination buffer. |
[in] | dst_len | Destination buffer length, in bytes. |
Example:
void kmac256_xof_squeeze | ( | sha3_xof_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze data from KMAC256 XOF context.
Squeeze len
bytes of output into destination buffer dst
from KMAC256 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | KMAC256 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example: