My Project
Classes | Functions
TurboSHAKE

Faster, reduced-round XOFs, as defined in the draft KangarooTwelve and TurboSHAKE specification. More...

Classes

struct  turboshake_t
 TurboShake XOF context. 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, 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 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, 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 with custom padding byte, then squeeze bytes out. More...
 
void turboshake128_init (turboshake_t *ts)
 Initialize TurboSHAKE128 context. More...
 
_Bool turboshake128_init_custom (turboshake_t *ts, const uint8_t pad)
 Initialize TurboSHAKE128 context with custom padding byte. More...
 
_Bool turboshake128_absorb (turboshake_t *ts, const uint8_t *src, const size_t len)
 Absorb data into TurboSHAKE128 context. More...
 
void turboshake128_squeeze (turboshake_t *ts, uint8_t *dst, const size_t len)
 Squeeze bytes from TurboSHAKE128 context. More...
 
void turboshake256_init (turboshake_t *ts)
 Initialize TurboSHAKE256 context. More...
 
_Bool turboshake256_init_custom (turboshake_t *ts, const uint8_t pad)
 Initialize TurboSHAKE256 context with custom padding byte. More...
 
_Bool turboshake256_absorb (turboshake_t *ts, const uint8_t *src, const size_t len)
 Absorb data into TurboSHAKE256 context. More...
 
void turboshake256_squeeze (turboshake_t *ts, uint8_t *dst, const size_t len)
 Squeeze bytes from TurboSHAKE256 context. More...
 

Detailed Description

Faster, reduced-round XOFs, as defined in the draft KangarooTwelve and TurboSHAKE specification.

Function Documentation

◆ turboshake128()

void turboshake128 ( const uint8_t *  src,
const size_t  src_len,
uint8_t *  dst,
const size_t  dst_len 
)

Absorb bytes into TurboSHAKE128, then squeeze bytes out.

Initialize internal TurboSHAKE128 context, absorb src_len bytes of input from source buffer src, then squeeze dst_len bytes of output into destination buffer dst.

Parameters
[in]srcSource buffer.
[in]src_lenSource buffer length, in bytes.
[out]dstDestination buffer.
[in]dst_lenDestination buffer length, in bytes.

◆ turboshake128_absorb()

_Bool turboshake128_absorb ( turboshake_t ts,
const uint8_t *  src,
const size_t  len 
)

Absorb data into TurboSHAKE128 context.

Absorb src_len bytes of input from source buffer src into TurboSHAKE128 context ts. Can be called iteratively to absorb input data in chunks.

Parameters
[in,out]tsTurboSHAKE128 context.
[in]srcSource buffer.
[in]lenSource buffer length, in bytes.
Returns
True if data was absorbed, and false otherwise (e.g., if context has already been finalized).

◆ turboshake128_custom()

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 with custom padding byte, then squeeze bytes out.

Initialize internal TurboSHAKE128 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.

Note: The padding byte value must be in the range [0x01, 0x7F] and can be used for domain separation.

Parameters
[in]padPadding byte.
[in]srcSource buffer.
[in]src_lenSource buffer length, in bytes.
[out]dstDestination buffer.
[in]dst_lenDestination buffer length, in bytes.

◆ turboshake128_init()

void turboshake128_init ( turboshake_t ts)

Initialize TurboSHAKE128 context.

Parameters
[out]tsTurboSHAKE128 context.

◆ turboshake128_init_custom()

_Bool turboshake128_init_custom ( turboshake_t ts,
const uint8_t  pad 
)

Initialize TurboSHAKE128 context with custom padding byte.

Initialize TurboSHAKE128 context with custom padding byte. The custom padding byte can be used as a domain separator and must be in the range [0x01, 0x7f].

Parameters
[out]tsTurboSHAKE128 context.
[in]padPadding byte (used for domain separation).
Returns
False if the padding byte is out of range and true otherwise.

◆ turboshake128_squeeze()

void turboshake128_squeeze ( turboshake_t ts,
uint8_t *  dst,
const size_t  len 
)

Squeeze bytes from TurboSHAKE128 context.

Squeeze dst_len bytes of output into destination buffer dst from TurboSHAKE128 context ts. Can be called iteratively to squeeze output data in chunks.

Parameters
[in,out]tsTurboSHAKE128 context.
[out]dstDestination buffer.
[in]lenDestination buffer length, in bytes.

◆ turboshake256()

void turboshake256 ( const uint8_t *  src,
const size_t  src_len,
uint8_t *  dst,
const size_t  dst_len 
)

Absorb bytes into TurboSHAKE256, then squeeze bytes out.

Initialize internal TurboSHAKE256 context, absorb src_len bytes of input from source buffer src, then squeeze dst_len bytes of output into destination buffer dst.

Parameters
[in]srcSource buffer.
[in]src_lenSource buffer length, in bytes.
[out]dstDestination buffer.
[in]dst_lenDestination buffer length, in bytes.

◆ turboshake256_absorb()

_Bool turboshake256_absorb ( turboshake_t ts,
const uint8_t *  src,
const size_t  len 
)

Absorb data into TurboSHAKE256 context.

Absorb src_len bytes of input from source buffer src into TurboSHAKE256 context ts. Can be called iteratively to absorb input data in chunks.

Parameters
[in,out]tsTurboSHAKE256 context.
[in]srcSource buffer.
[in]lenSource buffer length, in bytes.
Returns
True if data was absorbed, and false otherwise (e.g., if context has already been finalized).

◆ turboshake256_custom()

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 with custom padding byte, then squeeze bytes out.

Initialize internal TurboSHAKE256 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.

Note: The padding byte value must be in the range [0x01, 0x7F] and can be used for domain separation.

Parameters
[in]padPadding byte.
[in]srcSource buffer.
[in]src_lenSource buffer length, in bytes.
[out]dstDestination buffer.
[in]dst_lenDestination buffer length, in bytes.

◆ turboshake256_init()

void turboshake256_init ( turboshake_t ts)

Initialize TurboSHAKE256 context.

Parameters
[out]tsTurboSHAKE256 context.

◆ turboshake256_init_custom()

_Bool turboshake256_init_custom ( turboshake_t ts,
const uint8_t  pad 
)

Initialize TurboSHAKE256 context with custom padding byte.

Initialize TurboSHAKE256 context with custom padding byte. The custom padding byte can be used as a domain separator and must be in the range [0x01, 0x7f].

Parameters
[out]tsTurboSHAKE256 context.
[in]padPadding byte (used for domain separation).
Returns
False if the padding byte is out of range and true otherwise.

◆ turboshake256_squeeze()

void turboshake256_squeeze ( turboshake_t ts,
uint8_t *  dst,
const size_t  len 
)

Squeeze bytes from TurboSHAKE256 context.

Squeeze dst_len bytes of output into destination buffer dst from TurboSHAKE256 context ts. Can be called iteratively to squeeze output data in chunks.

Parameters
[in,out]tsTurboSHAKE256 context.
[out]dstDestination buffer.
[in]lenDestination buffer length, in bytes.