sha3
Embeddable C11 SHA-3 implementation.
|
SHA-3 Extendable-output functions (XOFs) with arbitrary length output, as defined in section 6.2 of FIPS 202. More...
Data Structures | |
struct | sha3_xof_t |
Iterative XOF context (all members are private). More... | |
Functions | |
void | shake128_init (sha3_xof_t *const xof) |
Initialize SHAKE128 extendable-output function (XOF) context. More... | |
_Bool | shake128_absorb (sha3_xof_t *xof, const uint8_t *msg, const size_t len) |
Absorb data into SHAKE128 XOF context. More... | |
void | shake128_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from SHAKE128 XOF context. More... | |
void | shake128 (const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb data into SHAKE128 XOF, then squeeze bytes out. More... | |
void | shake256_init (sha3_xof_t *xof) |
Initialize SHAKE256 extendable-output function (XOF) context. More... | |
_Bool | shake256_absorb (sha3_xof_t *xof, const uint8_t *msg, const size_t len) |
Absorb data into SHAKE256 XOF context. More... | |
void | shake256_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from SHAKE256 XOF context. More... | |
void | shake256 (const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb data into SHAKE256 XOF, then squeeze bytes out. More... | |
SHA-3 Extendable-output functions (XOFs) with arbitrary length output, as defined in section 6.2 of FIPS 202.
void shake128 | ( | const uint8_t * | src, |
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb data into SHAKE128 XOF, then squeeze bytes out.
Absorb data in buffer src
of length src_len
bytes into SHAKE128 XOF context, then squeeze dst_len
bytes of output into destination buffer dst
.
[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 shake128_absorb | ( | sha3_xof_t * | xof, |
const uint8_t * | msg, | ||
const size_t | len | ||
) |
Absorb data into SHAKE128 XOF context.
Absorb input data in msg
of length len
bytes into SHAKE128 XOF context xof
. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | SHAKE128 XOF context. |
[in] | msg | Input data. |
[in] | len | Input data length, in bytes. |
Example:
void shake128_init | ( | sha3_xof_t *const | xof | ) |
Initialize SHAKE128 extendable-output function (XOF) context.
[out] | xof | SHAKE128 XOF context. |
Example:
void shake128_squeeze | ( | sha3_xof_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from SHAKE128 XOF context.
Squeeze len
bytes of output into destination buffer dst
from SHAKE128 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | SHAKE128 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example:
void shake256 | ( | const uint8_t * | src, |
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb data into SHAKE256 XOF, then squeeze bytes out.
Absorb data in buffer src
of length src_len
bytes into SHAKE256 XOF context, then squeeze dst_len
bytes of output into destination buffer dst
.
[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 shake256_absorb | ( | sha3_xof_t * | xof, |
const uint8_t * | msg, | ||
const size_t | len | ||
) |
Absorb data into SHAKE256 XOF context.
Absorb input data in msg
of length len
bytes into SHAKE256 XOF context xof
. Can be called iteratively to absorb input data in chunks.
[in,out] | xof | SHAKE256 XOF context. |
[in] | msg | Input data. |
[in] | len | Input data length, in bytes. |
Example:
void shake256_init | ( | sha3_xof_t * | xof | ) |
Initialize SHAKE256 extendable-output function (XOF) context.
[out] | xof | SHAKE256 XOF context. |
Example:
void shake256_squeeze | ( | sha3_xof_t * | xof, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from SHAKE256 XOF context.
Squeeze len
bytes of output into destination buffer dst
from SHAKE256 XOF context xof
. Can be called iteratively to squeeze output data in chunks.
[in,out] | xof | SHAKE256 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example: