sha3
Embeddable C11 SHA-3 implementation.
|
Faster, reduced-round XOFs, as defined in the draft KangarooTwelve and TurboSHAKE specification. More...
Data Structures | |
struct | sha3_xof12_t |
Iterative XOF context (all members are private) for XOFs with 12 round permutations. More... | |
struct | turboshake_t |
TurboShake XOF context (all members are private). More... | |
Functions | |
void | turboshake128 (const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb bytes into TurboSHAKE128 XOF, then squeeze bytes out. More... | |
void | turboshake128_custom (const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb bytes into TurboSHAKE128 XOF with custom padding byte, then squeeze bytes out. More... | |
void | turboshake256 (const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb bytes into TurboSHAKE256 XOF, then squeeze bytes out. More... | |
void | turboshake256_custom (const uint8_t pad, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len) |
Absorb bytes into TurboSHAKE256 XOF with custom padding byte, then squeeze bytes out. More... | |
void | turboshake128_init (turboshake_t *ts) |
Initialize TurboSHAKE128 XOF context. More... | |
_Bool | turboshake128_init_custom (turboshake_t *ts, const uint8_t pad) |
Initialize TurboSHAKE128 XOF context with custom padding byte. More... | |
_Bool | turboshake128_absorb (turboshake_t *ts, const uint8_t *src, const size_t len) |
Absorb data into TurboSHAKE128 XOF context. More... | |
void | turboshake128_squeeze (turboshake_t *ts, uint8_t *dst, const size_t len) |
Squeeze bytes from TurboSHAKE128 XOF context. More... | |
void | turboshake256_init (turboshake_t *ts) |
Initialize TurboSHAKE256 XOF context. More... | |
_Bool | turboshake256_init_custom (turboshake_t *ts, const uint8_t pad) |
Initialize TurboSHAKE256 XOF context with custom padding byte. More... | |
_Bool | turboshake256_absorb (turboshake_t *ts, const uint8_t *src, const size_t len) |
Absorb data into TurboSHAKE256 XOF context. More... | |
void | turboshake256_squeeze (turboshake_t *ts, uint8_t *dst, const size_t len) |
Squeeze bytes from TurboSHAKE256 XOF context. More... | |
Faster, reduced-round XOFs, as defined in the draft KangarooTwelve and TurboSHAKE specification.
void turboshake128 | ( | const uint8_t * | src, |
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb bytes into TurboSHAKE128 XOF, then squeeze bytes out.
Initialize internal TurboSHAKE128 XOF context, absorb src_len
bytes of input from source buffer src
, 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 turboshake128_absorb | ( | turboshake_t * | ts, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into TurboSHAKE128 XOF context.
Absorb src_len
bytes of input from source buffer src
into TurboSHAKE128 XOF context ts
. Can be called iteratively to absorb input data in chunks.
[in,out] | ts | TurboSHAKE128 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void turboshake128_custom | ( | const uint8_t | pad, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb bytes into TurboSHAKE128 XOF with custom padding byte, then squeeze bytes out.
Initialize internal TurboSHAKE128 XOF context with custom padding byte pad
, absorb src_len
bytes of input from source buffer src
, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | pad | Padding byte. |
[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 turboshake128_init | ( | turboshake_t * | ts | ) |
Initialize TurboSHAKE128 XOF context.
[out] | ts | TurboSHAKE128 XOF context. |
Example:
_Bool turboshake128_init_custom | ( | turboshake_t * | ts, |
const uint8_t | pad | ||
) |
Initialize TurboSHAKE128 XOF context with custom padding byte.
Initialize TurboSHAKE128 XOF context with custom padding byte. The custom padding byte can be used as a domain separator and must be in the range [0x01, 0x7f].
[out] | ts | TurboSHAKE128 XOF context. |
[in] | pad | Padding byte (used for domain separation). |
Example:
void turboshake128_squeeze | ( | turboshake_t * | ts, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from TurboSHAKE128 XOF context.
Squeeze dst_len
bytes of output into destination buffer dst
from TurboSHAKE128 XOF context ts
. Can be called iteratively to squeeze output data in chunks.
[in,out] | ts | TurboSHAKE128 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example:
void turboshake256 | ( | const uint8_t * | src, |
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb bytes into TurboSHAKE256 XOF, then squeeze bytes out.
Initialize internal TurboSHAKE256 XOF context, absorb src_len
bytes of input from source buffer src
, 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 turboshake256_absorb | ( | turboshake_t * | ts, |
const uint8_t * | src, | ||
const size_t | len | ||
) |
Absorb data into TurboSHAKE256 XOF context.
Absorb len
bytes of input from source buffer src
into TurboSHAKE256 XOF context ts
. Can be called iteratively to absorb input data in chunks.
[in,out] | ts | TurboSHAKE256 XOF context. |
[in] | src | Source buffer. |
[in] | len | Source buffer length, in bytes. |
Example:
void turboshake256_custom | ( | const uint8_t | pad, |
const uint8_t * | src, | ||
const size_t | src_len, | ||
uint8_t * | dst, | ||
const size_t | dst_len | ||
) |
Absorb bytes into TurboSHAKE256 XOF with custom padding byte, then squeeze bytes out.
Initialize internal TurboSHAKE256 XOF context with custom padding byte pad
, absorb src_len
bytes of input from source buffer src
, then squeeze dst_len
bytes of output into destination buffer dst
.
[in] | pad | Padding byte. |
[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 turboshake256_init | ( | turboshake_t * | ts | ) |
Initialize TurboSHAKE256 XOF context.
[out] | ts | TurboSHAKE256 XOF context. |
Example:
_Bool turboshake256_init_custom | ( | turboshake_t * | ts, |
const uint8_t | pad | ||
) |
Initialize TurboSHAKE256 XOF context with custom padding byte.
Initialize TurboSHAKE256 XOF context with custom padding byte. The custom padding byte can be used as a domain separator and must be in the range [0x01, 0x7f].
[out] | ts | TurboSHAKE256 XOF context. |
[in] | pad | Padding byte (used for domain separation). |
Example:
void turboshake256_squeeze | ( | turboshake_t * | ts, |
uint8_t * | dst, | ||
const size_t | len | ||
) |
Squeeze bytes from TurboSHAKE256 XOF context.
Squeeze len
bytes of output into destination buffer dst
from TurboSHAKE256 context ts
. Can be called iteratively to squeeze output data in chunks.
[in,out] | ts | TurboSHAKE256 XOF context. |
[out] | dst | Destination buffer. |
[in] | len | Destination buffer length, in bytes. |
Example: