19 #include <string_view>
20 #include "lhashes/lhashes_Export.h"
40 void update (
const unsigned char* data, std::size_t length)
final;
43 [[nodiscard]] std::string
getHash() final;
46 [[nodiscard]] std::
size_t getLengthOfHash() const final;
49 void transform (const
unsigned char* message,
unsigned block_nb) noexcept;
51 static constinit const
unsigned SHA384_512_BLOCK_SIZE = (1024 / 8);
53 unsigned m_tot_len { 0 };
56 unsigned char m_block[2 * SHA384_512_BLOCK_SIZE] = {};
58 std::uint64_t m_h[8] = { 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL };
66 [[nodiscard]] LHASH_EXPORT std::string
sha512 (
const char* input, std::size_t length);
73 [[nodiscard]] LHASH_EXPORT std::string
sha512 (std::string_view input);
A base class representing an object that calculates a hash function.
A Hasher object that calculates a SHA512 hash.
void update(const unsigned char *data, std::size_t length) final
Updates the internal state of the hasher with new data.
std::string getHash() final
Retrieves the calculated SHA512 hash value as a string.
LHASH_EXPORT std::string sha512(std::string_view input)
Calculates a SHA512 hash for the given string.
LHASH_EXPORT std::string sha512(const char *input, std::size_t length)
Calculates a SHA512 hash for the given data.
This file defines the hash::Hasher class and the hash::hash() free functions.
Cryptographic hash functions.