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

SHA3 Algorithm More...

Typedefs

typedef hasher< detail::sha3_provider<> > digestpp::sha3
 SHA-3 hash function.
 
template<size_t N>
using digestpp::static_size::sha3 = hasher<detail::sha3_provider<N>>
 SHA-3 hash function (static-size version)
 

Detailed Description

SHA3 Algorithm

Typedef Documentation

◆ sha3 [1/2]

SHA-3 hash function.

Winner of the NIST SHA-3 competition (2012), based on the Keccak algorithm. Designed by Guido Bertoni, Joan Daemen, Michaƫl Peeters, and Gilles Van Assche.

SHA-3 uses a completely different design (sponge construction) compared to SHA-1 and SHA-2. It provides an alternative to SHA-2 with different security properties and resistance to length-extension attacks.

Specified in FIPS 202 (2015). SHA-3 is not a replacement for SHA-2, but an alternative. SHA-2 remains secure and widely used; SHA-3 provides diversity.

Type:
Cryptographic hash function.
Output size:
224 / 256 / 384 / 512 bits
Default size:
none (must be specified)
Exceptions
std::runtime_errorif the requested digest size is not supported
Example:
// Output a 256-bit SHA-3 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:
69070dda01975c8c120c3aada1b282394e7f032fa9cf32f4cb2259a0897dfc04
See also
hasher, digestpp::static_size::sha3

◆ sha3 [2/2]

SHA-3 hash function (static-size version)

Variant of SHA-3 with output size specified as template parameter.

Type:
Cryptographic hash function.
Output size:
224 / 256 / 384 / 512 bits
Example:
// Output a 256-bit SHA-3 digest of a string
hasher.absorb("The quick brown fox jumps over the lazy dog");
std::cout << hasher.hexdigest() << '\n';
Example output:
69070dda01975c8c120c3aada1b282394e7f032fa9cf32f4cb2259a0897dfc04
See also
hasher, digestpp::sha3