digestpp 1.0
C++11 header-only message digest library
Loading...
Searching...
No Matches
SHAKE

SHAKE Algorithms More...

Typedefs

typedef hasher< detail::shake_provider< 128, 24 > > digestpp::shake128
 SHAKE128 extendable output function.
 
typedef hasher< detail::shake_provider< 256, 24 > > digestpp::shake256
 SHAKE256 extendable output function.
 
typedef hasher< detail::shake_provider< 128, 24 >, mixin::cshake_mixindigestpp::cshake128
 cSHAKE128 customizable extendable output function
 
typedef hasher< detail::shake_provider< 256, 24 >, mixin::cshake_mixindigestpp::cshake256
 cSHAKE256 customizable extendable output function
 

Detailed Description

SHAKE Algorithms

Typedef Documentation

◆ cshake128

cSHAKE128 customizable extendable output function

Customizable variant of SHAKE128 with support for function name and customization string.

Specified in NIST SP 800-185.

cSHAKE provides domain separation through customization parameters, allowing the same underlying function to be safely used for different purposes.

When used without customization, cSHAKE128 produces the same output as SHAKE128. Function name is reserved for NIST-defined functions; use empty string for custom applications. Customization string provides domain separation for different use cases.

Type:
Extendable output function (XOF).

Optional parameters:

  • set_function_name() - NIST function name (usually empty for custom use)
  • set_customization() - Customization string for domain separation
Optional parameters:
function name, customization

See mixin::cshake_mixin for the description of optional parameters.

Example:
// Absorb a string and squeeze 32 bytes of output
hasher.set_customization("My Custom SHAKE");
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexsqueeze(32) << '\n';
Main class template implementing the public API for hashing.
Definition hasher.hpp:38
hasher & absorb(const T *data, size_t len)
Absorbs bytes from a C-style pointer to character buffer.
Definition hasher.hpp:86
std::string hexsqueeze(size_t len)
Squeeze bytes and return them as a hex string.
Definition hasher.hpp:296
Example output:
5b831bfe752f7f05d81f18f0e83a92eb48b9e3d460c10022ecb4852aa8b1f9d4
See also
hasher, shake128, mixin::cshake_mixin, k12

◆ cshake256

cSHAKE256 customizable extendable output function

Customizable variant of SHAKE256 with support for function name and customization string.

Specified in NIST SP 800-185.

Higher security variant of cSHAKE128, providing 256-bit security level.

When used without customization, cSHAKE256 produces the same output as SHAKE256. Function name is reserved for NIST-defined functions; use empty string for custom applications. Customization string provides domain separation for different use cases.

Type:
Extendable output function (XOF).

Optional parameters:

  • set_function_name() - NIST function name (usually empty for custom use)
  • set_customization() - Customization string for domain separation
Optional parameters:
function name, customization

See mixin::cshake_mixin for the description of optional parameters.

Example:
// Absorb a string and squeeze 32 bytes of output
hasher.set_customization("My Custom SHAKE");
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexsqueeze(32) << '\n';
Example output:
bcebde2c2e18f6efd99ee9e0def1383e86595d72e49b4754f7f727a962c3cd3d
See also
hasher, shake256, mixin::cshake_mixin, m14

◆ shake128

SHAKE128 extendable output function.

Extendable Output Function (XOF) based on SHA-3/Keccak. Part of the SHA-3 standard (FIPS 202).

SHAKE128 provides 128-bit security and can generate arbitrary-length output. Unlike fixed-length hash functions, SHAKE can produce outputs of any length, and can be called multiple times to generate additional output.

Specified in FIPS 202.

SHAKE128 provides security equivalent to SHA3-256 (128-bit collision resistance). For customizable variant with domain separation, see cshake128.

Type:
Extendable output function (XOF).
Example:
// Absorb a string and squeeze 32 bytes of output
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexsqueeze(32) << '\n';
Example output:
f4202e3c5852f9182a0430fd8144f0a74b95e7417ecae17db0f8cfeed0e3e66e
See also
hasher, cshake128, kmac128, k12

◆ shake256

SHAKE256 extendable output function.

Extendable Output Function (XOF) based on SHA-3/Keccak. Part of the SHA-3 standard (FIPS 202).

SHAKE256 provides 256-bit security and can generate arbitrary-length output. Recommended over SHAKE128 for applications requiring higher security.

Specified in FIPS 202.

SHAKE256 provides security equivalent to SHA3-512 (256-bit collision resistance). For customizable variant with domain separation, see cshake256.

Type:
Extendable output function (XOF).
Example:
// Absorb a string and squeeze 32 bytes of output
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexsqueeze(32) << '\n';
Example output:
2f671343d9b2e1604dc9dcf0753e5fe15c7c64a0d283cbbf722d411a0e36f6ca
See also
hasher, cshake256, kmac256, m14