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

BLAKE2 Algorithms More...

Typedefs

typedef hasher< detail::blake2_provider< uint64_t, detail::blake2_type::hash >, mixin::blake2_mixindigestpp::blake2b
 BLAKE2b hash function.
 
typedef hasher< detail::blake2_provider< uint32_t, detail::blake2_type::hash >, mixin::blake2_mixindigestpp::blake2s
 BLAKE2s hash function.
 
typedef hasher< detail::blake2_provider< uint64_t, detail::blake2_type::x_hash >, mixin::blake2_mixindigestpp::blake2xb
 BLAKE2xb hash function.
 
typedef hasher< detail::blake2_provider< uint32_t, detail::blake2_type::x_hash >, mixin::blake2_mixindigestpp::blake2xs
 BLAKE2xs hash function.
 
typedef hasher< detail::blake2_provider< uint64_t, detail::blake2_type::xof >, mixin::blake2_mixindigestpp::blake2xb_xof
 BLAKE2xb in XOF mode.
 
typedef hasher< detail::blake2_provider< uint32_t, detail::blake2_type::xof >, mixin::blake2_mixindigestpp::blake2xs_xof
 BLAKE2xs in XOF mode.
 
template<size_t N>
using digestpp::static_size::blake2b = hasher<detail::blake2_provider<uint64_t, detail::blake2_type::hash, N>, mixin::blake2_mixin>
 BLAKE2b hash function (static-size version)
 
template<size_t N>
using digestpp::static_size::blake2s = hasher<detail::blake2_provider<uint32_t, detail::blake2_type::hash, N>, mixin::blake2_mixin>
 BLAKE2s hash function (static-size version)
 
template<size_t N>
using digestpp::static_size::blake2xb = hasher<detail::blake2_provider<uint64_t, detail::blake2_type::x_hash, N>, mixin::blake2_mixin>
 BLAKE2xb hash function (static-size version)
 
template<size_t N>
using digestpp::static_size::blake2xs = hasher<detail::blake2_provider<uint32_t, detail::blake2_type::x_hash, N>, mixin::blake2_mixin>
 BLAKE2xs hash function (static-size version)
 
typedef hasher< detail::blake2p_provider< uint64_t, detail::blake2_type::hash >, mixin::blake2_mixindigestpp::blake2bp
 BLAKE2bp hash function.
 
typedef hasher< detail::blake2p_provider< uint32_t, detail::blake2_type::hash >, mixin::blake2_mixindigestpp::blake2sp
 BLAKE2sp hash function.
 
template<size_t N>
using digestpp::static_size::blake2bp = hasher<detail::blake2p_provider<uint64_t, detail::blake2_type::hash, N>, mixin::blake2_mixin>
 BLAKE2bp hash function (static-size version)
 
template<size_t N>
using digestpp::static_size::blake2sp = hasher<detail::blake2p_provider<uint32_t, detail::blake2_type::hash, N>, mixin::blake2_mixin>
 BLAKE2sp hash function (static-size version)
 

Detailed Description

BLAKE2 Algorithms

BLAKE2 Algorithms

Typedef Documentation

◆ blake2b [1/2]

BLAKE2b hash function.

Fast cryptographic hash function optimized for 64-bit platforms.

BLAKE2b deliberately reduces the number of rounds from 16 (BLAKE-512) to 12 rounds. The round reduction was based on the argument that BLAKE's original 16 rounds were overly conservative relative to known cryptanalysis. However, users should be aware this is a performance-vs-security trade-off, not a pure improvement. For maximum security margin, consider SHA-3 or original BLAKE.

Designed by Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, and Christian Winnerlein.

Standardized as RFC 7693 (Informational, November 2015).

Type:
Cryptographic hash function.
Output size:
8 - 512 bits
Default size:
512 bits
Exceptions
std::runtime_errorif the requested digest size is not divisible by 8 (full bytes), or is not within the supported range

Optional parameters:

  • set_salt() - 16-byte salt for hash randomization
  • set_personalization() - 16-byte string for domain separation
  • set_key() - Up to 64-byte key for MAC mode (keyed hashing)
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2b digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Main class template implementing the public API for hashing.
Definition hasher.hpp:38
std::string hexdigest() const
Return hex digest of absorbed data.
Definition hasher.hpp:372
hasher & absorb(const T *data, size_t len)
Absorbs bytes from a C-style pointer to character buffer.
Definition hasher.hpp:86
Example output:
01718cec35cd3d796dd00020e0bfecb473ad23457d063b75eff29c0ffa2e58a9
See also
hasher, mixin::blake2_mixin, digestpp::blake2xb, digestpp::blake, digestpp::static_size::blake2b

◆ blake2b [2/2]

BLAKE2b hash function (static-size version)

Variant of BLAKE2b with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
8 - 512 bits

Optional parameters:

  • set_salt() - 16-byte salt
  • set_personalization() - 16-byte personalization
  • set_key() - Up to 64-byte key
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2b digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
01718cec35cd3d796dd00020e0bfecb473ad23457d063b75eff29c0ffa2e58a9
See also
hasher, mixin::blake2_mixin, digestpp::blake2b, blake

◆ blake2bp [1/2]

BLAKE2bp hash function.

Parallel version of BLAKE2b function.

Type:
Cryptographic hash function.
Output size:
8 - 512 bits
Default size:
512 bits
Exceptions
std::runtime_errorif the requested digest size is not divisible by 8 (full bytes), or is not within the supported range

Optional parameters:

  • set_salt() - 16-byte salt for hash randomization
  • set_personalization() - 16-byte string for domain separation
  • set_key() - Up to 64-byte key for MAC mode (keyed hashing)
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2bp digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
4184d2acbcce03adc3b8f2fccd1ae3d6ced3aa0b051ae648f6986bb46579a0cf
See also
hasher, mixin::blake2_mixin, digestpp::blake2b, digestpp::static_size::blake2bp

◆ blake2bp [2/2]

BLAKE2bp hash function (static-size version)

Variant of BLAKE2bp with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
8 - 512 bits

Optional parameters:

  • set_salt() - 16-byte salt
  • set_personalization() - 16-byte personalization
  • set_key() - Up to 64-byte key
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2bp digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
4184d2acbcce03adc3b8f2fccd1ae3d6ced3aa0b051ae648f6986bb46579a0cf
See also
hasher, mixin::blake2_mixin, digestpp::blake2bp, blake2b

◆ blake2s [1/2]

BLAKE2s hash function.

Fast cryptographic hash function optimized for 8- to 32-bit platforms. Designed for environments where BLAKE2b's 64-bit operations are not optimal.

BLAKE2s reduces the number of rounds from 14 (BLAKE-256) to 10 rounds, The round reduction was based on the argument that BLAKE's original 16 rounds were overly conservative relative to known cryptanalysis. However, users should be aware this is a performance-vs-security trade-off, not a pure improvement. For maximum security margin, consider SHA-3 or original BLAKE.

Designed by Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, and Christian Winnerlein.

Standardized as RFC 7693 (Informational, November 2015).

Type:
Cryptographic hash function.
Output size:
8 - 256 bits
Default size:
256 bits
Exceptions
std::runtime_errorif the requested digest size is not divisible by 8 (full bytes), or is not within the supported range

Optional parameters:

  • set_salt() - 8-byte salt for hash randomization
  • set_personalization() - 8-byte string for domain separation
  • set_key() - Up to 32-byte key for MAC mode (keyed hashing)
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2s digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
606beeec743ccbeff6cbcdf5d5302aa855c256c29b88c8ed331ea1a6bf3c8812
See also
hasher, mixin::blake2_mixin, digestpp::blake2xs, digestpp::blake, digestpp::static_size::blake2s

◆ blake2s [2/2]

BLAKE2s hash function (static-size version)

Variant of BLAKE2s with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
8 - 256 bits

Optional parameters:

  • set_salt() - 8-byte salt
  • set_personalization() - 8-byte personalization
  • set_key() - Up to 32-byte key
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2s digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
606beeec743ccbeff6cbcdf5d5302aa855c256c29b88c8ed331ea1a6bf3c8812
See also
hasher, mixin::blake2_mixin, digestpp::blake2s, blake

◆ blake2sp [1/2]

BLAKE2sp hash function.

Parallel version of BLAKE2s function.

Type:
Cryptographic hash function.
Output size:
8 - 256 bits
Default size:
256 bits
Exceptions
std::runtime_errorif the requested digest size is not divisible by 8 (full bytes), or is not within the supported range

Optional parameters:

  • set_salt() - 8-byte salt for hash randomization
  • set_personalization() - 8-byte string for domain separation
  • set_key() - Up to 32-byte key for MAC mode (keyed hashing)
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2sp digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
cf192976714bb648e72b29fa90e6bf0fbc5bf2efe7d5c26ed8ff34e855368691
See also
hasher, mixin::blake2_mixin, digestpp::blake2s, digestpp::static_size::blake2sp

◆ blake2sp [2/2]

BLAKE2sp hash function (static-size version)

Variant of BLAKE2sp with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
8 - 256 bits

Optional parameters:

  • set_salt() - 8-byte salt
  • set_personalization() - 8-byte personalization
  • set_key() - Up to 32-byte key
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2sp digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
cf192976714bb648e72b29fa90e6bf0fbc5bf2efe7d5c26ed8ff34e855368691
See also
hasher, mixin::blake2_mixin, digestpp::blake2sp, blake2s

◆ blake2xb [1/2]

BLAKE2xb hash function.

Extended output variant of BLAKE2b supporting arbitrary output lengths. Based on BLAKE2b with additional processing for outputs exceeding 64 bytes.

Use this variant when the required hash size is known in advance. For unknown output size (streaming output), use blake2xb_xof

BLAKE2xb outputs are DIFFERENT from BLAKE2b outputs for the same size. For example: blake2xb(512)blake2b(512)

Type:
Cryptographic hash function.
Output size:
arbitrary
Default size:
512 bits
Exceptions
std::runtime_errorif the requested digest size is not divisible by 8 (full bytes)

Optional parameters:

  • set_salt() - 16-byte salt for hash randomization
  • set_personalization() - 16-byte string for domain separation
  • set_key() - Up to 64-byte key for MAC mode
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2xb digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
ca7a0c9c54b4b93c0bee0aa3a4d63e4f7fb87e3e0a9050522377fde76f0b6c01
See also
hasher, mixin::blake2_mixin, blake2b, blake2xb_xof, blake, digestpp::static_size::blake2xb

◆ blake2xb [2/2]

BLAKE2xb hash function (static-size version)

Variant of BLAKE2xb with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
arbitrary

Optional parameters:

  • set_salt() - 16-byte salt
  • set_personalization() - 16-byte personalization
  • set_key() - Up to 64-byte key
Optional parameters:
salt, personalization, key

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

Example:
// Output a 256-bit BLAKE2xb digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
ca7a0c9c54b4b93c0bee0aa3a4d63e4f7fb87e3e0a9050522377fde76f0b6c01
See also
hasher, mixin::blake2_mixin, digestpp::blake2xb, blake

◆ blake2xb_xof

BLAKE2xb in XOF mode.

Extendable Output Function (XOF) mode of BLAKE2xb. Use when the required output length is not known in advance or when streaming output is needed.

In XOF mode, you can call squeeze() multiple times to generate arbitrary amounts of output. For fixed-length output known in advance, use blake2xb

Type:
Extendable output function (XOF).

Optional parameters:

  • set_salt() - 16-byte salt for hash randomization
  • set_personalization() - 16-byte string for domain separation
  • set_key() - Up to 64-byte key for MAC mode
Optional parameters:
salt, personalization, key

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

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';
std::string hexsqueeze(size_t len)
Squeeze bytes and return them as a hex string.
Definition hasher.hpp:296
Example output:
364e84ca4c103df292306c93ebba6f6633d5e9cc8a95e040498e9a012d5ca534
See also
hasher, mixin::blake2_mixin, kt128, kt256

◆ blake2xs [1/2]

BLAKE2xs hash function.

Extended output variant of BLAKE2s supporting arbitrary output lengths.

Use this variant when the required hash size is known in advance. For unknown output size (streaming output), use blake2xs_xof

BLAKE2xs outputs are DIFFERENT from BLAKE2s outputs for the same size. For example: blake2xs(256)blake2s(256)

Type:
Cryptographic hash function.
Output size:
arbitrary
Default size:
256 bits
Exceptions
std::runtime_errorif the requested digest size is not divisible by 8 (full bytes)

Optional parameters:

  • set_salt() - 8-byte salt for hash randomization
  • set_personalization() - 8-byte string for domain separation
  • set_key() - Up to 32-byte key for MAC mode
Optional parameters:
salt, personalization, key

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

Example:
// Output a 512-bit BLAKE2xs digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
e709f8377d21507c166e5dd2279a1f58b290792d65dafcc5647b6e439a974227503c341341572725709b874e95f13a438677aa6f9648467fd341e0f3e5421840
See also
hasher, mixin::blake2_mixin, blake2s, blake2xs_xof, blake, digestpp::static_size::blake2xs

◆ blake2xs [2/2]

BLAKE2xs hash function (static-size version)

Variant of BLAKE2xs with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
arbitrary

Optional parameters:

  • set_salt() - 8-byte salt
  • set_personalization() - 8-byte personalization
  • set_key() - Up to 32-byte key
Optional parameters:
salt, personalization, key

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

Example:
// Output a 512-bit BLAKE2xs digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
e709f8377d21507c166e5dd2279a1f58b290792d65dafcc5647b6e439a974227503c341341572725709b874e95f13a438677aa6f9648467fd341e0f3e5421840
See also
hasher, mixin::blake2_mixin, digestpp::blake2xs, blake

◆ blake2xs_xof

BLAKE2xs in XOF mode.

Extendable Output Function (XOF) mode of BLAKE2xs. 32-bit optimized version. Use when the required output length is not known in advance.

In XOF mode, you can call squeeze() multiple times to generate arbitrary amounts of output. For fixed-length output known in advance, use blake2xs

Type:
Extendable output function (XOF).

Optional parameters:

  • set_salt() - 8-byte salt for hash randomization
  • set_personalization() - 8-byte string for domain separation
  • set_key() - Up to 32-byte key for MAC mode
Optional parameters:
salt, personalization, key

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

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:
0650cde4df888a06eada0f0fecb3c17594304b4a03fdd678182f27db1238b1747e33c34ae539fe2179a7594442b5cc9a7a0f398bb15ac3095a397de6a60061d6
See also
hasher, mixin::blake2_mixin, k12