sha3
Embeddable C11 SHA-3 implementation.
|
Customizable SHAKE (cSHAKE) extendable-output function (XOF), as defined in section 3 of SP 800-185. More...
Data Structures | |
struct | cshake_params_t |
cSHAKE parameters. More... | |
Functions | |
void | cshake128 (const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Initialize cSHAKE128, absorb data, then squeeze bytes out. More... | |
void | cshake256 (const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Initialize cSHAKE256, absorb data, then squeeze bytes out. More... | |
void | cshake128_xof_init (sha3_xof_t *xof, const cshake_params_t params) |
Initialize cSHAKE128 XOF context. More... | |
_Bool | cshake128_xof_absorb (sha3_xof_t *xof, const uint8_t *src, const size_t len) |
Absorb data into cSHAKE128 XOF context. More... | |
void | cshake128_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from cSHAKE128 XOF context. More... | |
void | cshake256_xof_init (sha3_xof_t *xof, const cshake_params_t params) |
Initialize cSHAKE256 XOF context. More... | |
_Bool | cshake256_xof_absorb (sha3_xof_t *xof, const uint8_t *src, const size_t len) |
Absorb data into cSHAKE256 XOF context. More... | |
void | cshake256_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from cSHAKE256 XOF context. More... | |
Customizable SHAKE (cSHAKE) extendable-output function (XOF), as defined in section 3 of SP 800-185.
void cshake128 | ( | const cshake_params_t | params, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Initialize cSHAKE128, absorb data, then squeeze bytes out.
Initialize internal cSHAKE128 (customizable SHAKE128, as defined in section 3 of NIST SP 800-185) context with customization 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 | cSHAKE customization 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 cshake128_xof_absorb | ( | sha3_xof_t * | xof, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into cSHAKE128 XOF context.
Absorb data in buffer src
of length len
bytes into cSHAKE128 XOF context xof
. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | cSHAKE128 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void cshake128_xof_init | ( | sha3_xof_t * | xof, |
const cshake_params_t | params | ||
) |
Initialize cSHAKE128 XOF context.
Initialize cSHAKE128 (customizable SHAKE128, as defined in section 3 of NIST SP 800-185) XOF context with customization parameters params
.
[out] | xof | cSHAKE128 XOF context. |
[in] | params | cSHAKE128 customization parameters. |
Example:
void cshake128_xof_squeeze | ( | sha3_xof_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from cSHAKE128 XOF context.
Squeeze dst_len
bytes of output into destination buffer dst
from cSHAKE128 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | cSHAKE128 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example:
void cshake256 | ( | const cshake_params_t | params, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Initialize cSHAKE256, absorb data, then squeeze bytes out.
Initialize internal cSHAKE256 (customizable SHAKE256, as defined in section 3 of NIST SP 800-185) context with customization 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 | cSHAKE customization 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 cshake256_xof_absorb | ( | sha3_xof_t * | xof, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into cSHAKE256 XOF context.
Absorb data in buffer src
of length len
bytes into cSHAKE256 XOF context xof
. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | cSHAKE256 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void cshake256_xof_init | ( | sha3_xof_t * | xof, |
const cshake_params_t | params | ||
) |
Initialize cSHAKE256 XOF context.
Initialize cSHAKE256 (customizable SHAKE256, as defined in section 3 of NIST SP 800-185) XOF context with customization parameters params
.
[out] | xof | cSHAKE256 XOF context. |
[in] | params | cSHAKE256 customization parameters. |
Example:
void cshake256_xof_squeeze | ( | sha3_xof_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from cSHAKE256 XOF context.
Squeeze dst_len
bytes of output into destination buffer dst
from cSHAKE256 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | cSHAKE256 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example: