sha3
Embeddable C11 SHA-3 implementation.
|
eXtendable Output Functions (XOF) with both fixed-length and 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 (const uint8_t *msg, size_t len, uint8_t dst[static 16]) |
Hash data with SHAKE128. More... | |
void | shake256 (const uint8_t *msg, size_t len, uint8_t dst[static 32]) |
Hash data with SHAKE256. More... | |
void | shake128_xof_init (sha3_xof_t *const xof) |
Initialize SHAKE128 extendable-output function (XOF) context. More... | |
_Bool | shake128_xof_absorb (sha3_xof_t *xof, const uint8_t *msg, const size_t len) |
Absorb data into SHAKE128 XOF context. More... | |
void | shake128_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from SHAKE128 XOF context. More... | |
void | shake128_xof_once (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_xof_init (sha3_xof_t *xof) |
Initialize SHAKE256 extendable-output function (XOF) context. More... | |
_Bool | shake256_xof_absorb (sha3_xof_t *xof, const uint8_t *msg, const size_t len) |
Absorb data into SHAKE256 XOF context. More... | |
void | shake256_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len) |
Squeeze bytes from SHAKE256 XOF context. More... | |
void | shake256_xof_once (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... | |
eXtendable Output Functions (XOF) with both fixed-length and arbitrary length output, as defined in section 6.2 of FIPS 202.
SHA-3 Extendable-output functions (XOFs) with fixed-length and arbitrary-length output, as defined in section 6.2 of FIPS 202.
void shake128 | ( | const uint8_t * | msg, |
size_t | len, | ||
uint8_t | dst[static 16] | ||
) |
Hash data with SHAKE128.
Hash input message in buffer msg
of length len
bytes with SHAKE128 (FIPS 202, section 6.2) and write 16 bytes of output to destination buffer dst
.
[in] | msg | Input message. |
[in] | len | Input message length, in bytes. |
[out] | dst | Destination buffer. Must be at least 16 bytes in length. |
Example:
_Bool shake128_xof_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_xof_init | ( | sha3_xof_t *const | xof | ) |
Initialize SHAKE128 extendable-output function (XOF) context.
[out] | xof | SHAKE128 XOF context. |
Example:
void shake128_xof_once | ( | 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:
void shake128_xof_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 * | msg, |
size_t | len, | ||
uint8_t | dst[static 32] | ||
) |
Hash data with SHAKE256.
Hash input message in buffer msg
of length len
bytes with SHAKE256 (FIPS 202, section 6.2) and write 32 bytes of output to destination buffer dst
.
[in] | msg | Input message. |
[in] | len | Input message length, in bytes. |
[out] | dst | Destination buffer. Must be at least 32 bytes in length. |
Example:
_Bool shake256_xof_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_xof_init | ( | sha3_xof_t * | xof | ) |
Initialize SHAKE256 extendable-output function (XOF) context.
[out] | xof | SHAKE256 XOF context. |
Example:
void shake256_xof_once | ( | 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:
void shake256_xof_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: