Death::Cryptography::Sha256 class

Computes SHA-256 digest of data fed in parts.

Unlike xxHash3(), it's a cryptographic hash, so it's suitable for verifying downloaded files and for content-addressed storage of files that came from outside. Data can be passed by Update() in parts of any size, the digest is then returned by Finish().

Public static variables

static std::size_t DigestLength constexpr
Length of the digest in bytes.

Public static functions

static void Compute(const void* data, std::size_t length, std::uint8_t(&digest)[DigestLength])
Computes the digest of a single buffer.

Constructors, destructors, conversion operators

Sha256()

Public functions

void Reset()
Starts a new digest, everything passed so far is forgotten.
void Update(const void* data, std::size_t length)
Adds data to the digest.
void Finish(std::uint8_t(&digest)[DigestLength])
Completes the digest and writes it to digest, the instance has to be reset before reuse.