My Project
Classes | Functions
cSHAKE

Fixed-length and XOF variants of the customizable-SHAKE primitive, as defined in section 3 of SP 800-185. More...

Classes

struct  cshake_params_t
 cSHAKE parameters. More...
 

Functions

void cshake128 (const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
 Initialize cSHAKE128, absorb data, then squeeze bytes out. More...
 
void cshake256 (const cshake_params_t params, const uint8_t *src, const size_t src_len, uint8_t *dst, const size_t dst_len)
 Initialize cSHAKE256, absorb data, then squeeze bytes out. More...
 
void cshake128_xof_init (sha3_xof_t *xof, const cshake_params_t params)
 Initialize cSHAKE128 XOF context. More...
 
_Bool cshake128_xof_absorb (sha3_xof_t *xof, const uint8_t *src, const size_t len)
 Absorb data into cSHAKE128 XOF context. More...
 
void cshake128_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len)
 Squeeze bytes from cSHAKE128 XOF context. More...
 
void cshake256_xof_init (sha3_xof_t *xof, const cshake_params_t params)
 Initialize cSHAKE256 XOF context. More...
 
_Bool cshake256_xof_absorb (sha3_xof_t *xof, const uint8_t *src, const size_t len)
 Absorb data into cSHAKE256 XOF context. More...
 
void cshake256_xof_squeeze (sha3_xof_t *xof, uint8_t *dst, const size_t len)
 Squeeze bytes from cSHAKE256 XOF context. More...
 

Detailed Description

Fixed-length and XOF variants of the customizable-SHAKE primitive, as defined in section 3 of SP 800-185.

Function Documentation

◆ cshake128()

void cshake128 ( const cshake_params_t  params,
const uint8_t *  src,
const size_t  src_len,
uint8_t *  dst,
const size_t  dst_len 
)

Initialize cSHAKE128, absorb data, then squeeze bytes out.

Initialize internal cSHAKE128 (customizable SHAKE128, as defined in section 3 of NIST SP 800-185) context with customization parameters params, absorb data in buffer src of length src_len bytes into internal context, then squeeze dst_len bytes of output into destination buffer dst.

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

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

◆ cshake128_xof_absorb()

_Bool cshake128_xof_absorb ( sha3_xof_t xof,
const uint8_t *  src,
const size_t  len 
)

Absorb data into cSHAKE128 XOF context.

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

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

Parameters
[in,out]xofcSHAKE128 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 squeezed).

◆ cshake128_xof_init()

void cshake128_xof_init ( sha3_xof_t xof,
const cshake_params_t  params 
)

Initialize cSHAKE128 XOF context.

Initialize cSHAKE128 (customizable SHAKE128, as defined in section 3 of NIST SP 800-185) XOF context with customization parameters params.

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

Parameters
[out]xofcSHAKE128 context.
[in]paramscSHAKE128 customization parameters.

◆ cshake128_xof_squeeze()

void cshake128_xof_squeeze ( sha3_xof_t xof,
uint8_t *  dst,
const size_t  len 
)

Squeeze bytes from cSHAKE128 XOF context.

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

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

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

◆ cshake256()

void cshake256 ( const cshake_params_t  params,
const uint8_t *  src,
const size_t  src_len,
uint8_t *  dst,
const size_t  dst_len 
)

Initialize cSHAKE256, absorb data, then squeeze bytes out.

Initialize internal cSHAKE256 (customizable SHAKE256, as defined in section 3 of NIST SP 800-185) context with customization parameters params, absorb data in buffer src of length src_len bytes into internal context, then squeeze dst_len bytes of output into destination buffer dst.

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

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

◆ cshake256_xof_absorb()

_Bool cshake256_xof_absorb ( sha3_xof_t xof,
const uint8_t *  src,
const size_t  len 
)

Absorb data into cSHAKE256 XOF context.

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

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

Parameters
[in,out]xofcSHAKE256 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 squeezed).

◆ cshake256_xof_init()

void cshake256_xof_init ( sha3_xof_t xof,
const cshake_params_t  params 
)

Initialize cSHAKE256 XOF context.

Initialize cSHAKE256 (customizable SHAKE256, as defined in section 3 of NIST SP 800-185) XOF context with customization parameters params.

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

Parameters
[out]xofcSHAKE256 context.
[in]paramscSHAKE256 customization parameters.

◆ cshake256_xof_squeeze()

void cshake256_xof_squeeze ( sha3_xof_t xof,
uint8_t *  dst,
const size_t  len 
)

Squeeze bytes from cSHAKE256 XOF context.

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

Note: cSHAKE is used to implement the hash and extendable output functions (XOF) defined in NIST SP 800-185 and should generally not be used directly.

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