18 #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] = { 0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, 0x9159015a3070dd17ULL, 0x152fecd8f70e5939ULL, 0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL, 0xdb0c2e0d64f98fa7ULL, 0x47b5481dbefa4fa4ULL };
66 [[nodiscard]] LHASH_EXPORT std::string
sha384 (
const char* input, std::size_t length);
73 [[nodiscard]] LHASH_EXPORT std::string
sha384 (std::string_view input);
A base class representing an object that calculates a hash function.
A Hasher object that calculates a SHA384 hash.
std::string getHash() final
Retrieves the calculated SHA384 hash value as a string.
void update(const unsigned char *data, std::size_t length) final
Updates the internal state of the hasher with new data.
LHASH_EXPORT std::string sha384(std::string_view input)
Calculates a SHA384 hash for the given string.
LHASH_EXPORT std::string sha384(const char *input, std::size_t length)
Calculates a SHA384 hash for the given data.
This file defines the hash::Hasher class and the hash::hash() free functions.
Cryptographic hash functions.