My Project
Classes | Functions
SHAKE

eXtendable Output Functions (XOF) with both fixed-length and arbitrary length output, as defined in section 6.2 of FIPS 202. More...

Classes

struct  sha3_xof_t
 Iterative XOF context (all members are private). More...
 

Functions

void shake128 (const uint8_t *m, size_t m_len, uint8_t dst[static 16])
 Hash data with SHAKE128. More...
 
void shake256 (const uint8_t *m, size_t m_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 *m, 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 dst_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 *m, 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 dst_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...
 

Detailed Description

eXtendable Output Functions (XOF) with both fixed-length and arbitrary length output, as defined in section 6.2 of FIPS 202.

SHA-3 XOFs with both fixed-length output and arbitrary-length output, as defined in section 6.2 of FIPS 202.

Function Documentation

◆ shake128()

void shake128 ( const uint8_t *  m,
size_t  m_len,
uint8_t  dst[static 16] 
)

Hash data with SHAKE128.

Hash input message in buffer m of length m_len bytes with SHAKE128 (FIPS 202, section 6.2) and write 16 bytes of output to destination buffer dst.

Parameters
[in]mInput message.
[in]m_lenInput message length, in bytes.
[out]dstDestination array. Must be at least 16 bytes in length.

◆ shake128_xof_absorb()

_Bool shake128_xof_absorb ( sha3_xof_t xof,
const uint8_t *  m,
const size_t  len 
)

Absorb data into SHAKE128 XOF context.

Absorb input data in m of length len bytes into SHAKE128 XOF context xof. Can be called iteratively to absorb input data in chunks.

Parameters
[in,out]xofSHAKE128 XOF context.
[in]mInput data.
[in]lenInput data length, in bytes.
Returns
True if data was absorbed, and false otherwise (e.g., if context has already been squeezed).

◆ shake128_xof_init()

void shake128_xof_init ( sha3_xof_t *const  xof)

Initialize SHAKE128 extendable-output function (XOF) context.

Parameters
[out]xofSHAKE128 XOF context.

◆ shake128_xof_once()

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.

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

◆ shake128_xof_squeeze()

void shake128_xof_squeeze ( sha3_xof_t xof,
uint8_t *  dst,
const size_t  dst_len 
)

Squeeze bytes from SHAKE128 XOF context.

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

Parameters
[in,out]xofSHAKE128 XOF context.
[out]dstDestination buffer.
[in]dst_lenDestination buffer length, in bytes.

◆ shake256()

void shake256 ( const uint8_t *  m,
size_t  m_len,
uint8_t  dst[static 32] 
)

Hash data with SHAKE256.

Hash input message in buffer m of length m_len bytes with SHAKE256 (FIPS 202, section 6.2) and write the result to output buffer dst.

Parameters
[in]mInput message.
[in]m_lenInput message length, in bytes.
[out]dstDestination array. Must be at least 16 bytes in length.

◆ shake256_xof_absorb()

_Bool shake256_xof_absorb ( sha3_xof_t xof,
const uint8_t *  m,
const size_t  len 
)

Absorb data into SHAKE256 XOF context.

Absorb input data in m of length len bytes into SHAKE256 XOF context xof. Can be called iteratively to absorb input data in chunks.

Parameters
[in,out]xofSHAKE256 XOF context.
[in]mInput data.
[in]lenInput data length, in bytes.
Returns
True if data was absorbed, and false otherwise (e.g., if context has already been squeezed).

◆ shake256_xof_init()

void shake256_xof_init ( sha3_xof_t xof)

Initialize SHAKE256 extendable-output function (XOF) context.

Parameters
[out]xofSHAKE256 XOF context.

◆ shake256_xof_once()

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.

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

◆ shake256_xof_squeeze()

void shake256_xof_squeeze ( sha3_xof_t xof,
uint8_t *  dst,
const size_t  dst_len 
)

Squeeze bytes from SHAKE256 XOF context.

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

Parameters
[in,out]xofSHAKE256 XOF context.
[out]dstDestination buffer.
[in]dst_lenDestination buffer length, in bytes.