18 #include <string_view>
21 #include "lhashes/lhashes_Export.h"
41 void update (
const unsigned char* message, std::size_t len)
final;
44 [[nodiscard]] std::string
getHash() final;
47 [[nodiscard]] std::
size_t getLengthOfHash() const final;
50 void transform (const
unsigned char* message,
unsigned block_nb) noexcept;
52 static constexpr auto blocksize = 512 / 8;
54 unsigned m_len { 0u };
55 unsigned m_tot_len { 0u };
57 unsigned char m_block[2 * blocksize] = {};
59 std::uint32_t m_h[8] { 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 };
67 [[nodiscard]] LHASH_EXPORT std::string
sha224 (
const char* input, std::size_t length);
74 [[nodiscard]] LHASH_EXPORT std::string
sha224 (std::string_view input);
A base class representing an object that calculates a hash function.
A Hasher object that calculates a SHA224 hash.
void update(const unsigned char *message, std::size_t len) final
Updates the internal state of the hasher with new data.
std::string getHash() final
Retrieves the calculated SHA224 hash value as a string.
LHASH_EXPORT std::string sha224(const char *input, std::size_t length)
Calculates a SHA224 hash for the given data.
LHASH_EXPORT std::string sha224(std::string_view input)
Calculates a SHA224 hash for the given data.
This file defines the hash::Hasher class and the hash::hash() free functions.
Cryptographic hash functions.