19 #include <string_view>
20 #include "lhashes/lhashes_Export.h"
43 void update (
const unsigned char* data, std::size_t length)
final;
46 [[nodiscard]] std::string
getHash() final;
49 [[nodiscard]] std::
size_t getLengthOfHash() const final;
52 std::uint32_t digest[5] { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 };
56 std::uint64_t transforms { 0 };
64 [[nodiscard]] LHASH_EXPORT std::string
sha1 (
const char* input, std::size_t length);
71 [[nodiscard]] LHASH_EXPORT std::string
sha1 (std::string_view input);
A base class representing an object that calculates a hash function.
A Hasher object that calculates a SHA1 hash.
std::string getHash() final
Retrieves the calculated SHA1 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 sha1(const char *input, std::size_t length)
Calculates a SHA1 hash for the given data.
LHASH_EXPORT std::string sha1(std::string_view input)
Calculates a SHA1 hash for the given string.
This file defines the hash::Hasher class and the hash::hash() free functions.
Cryptographic hash functions.