18 #include <string_view>
20 #include "lhashes/lhashes_Export.h"
43 void update (
const unsigned char* input, std::size_t length)
final;
46 [[nodiscard]] std::string
getHash() final;
49 [[nodiscard]] std::
size_t getLengthOfHash() const final;
52 void transform (const std::uint8_t* block) noexcept;
54 static constexpr auto blocksize = 64;
56 std::uint8_t buffer[blocksize] = {};
57 std::uint32_t count[2] = { 0, 0 };
58 std::uint32_t state[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 };
59 std::uint8_t digest[16] = {};
67 [[nodiscard]] LHASH_EXPORT std::string
md5 (
const char* input, std::size_t length);
74 [[nodiscard]] LHASH_EXPORT std::string
md5 (std::string_view input);
A base class representing an object that calculates a hash function.
A Hasher object that calculates an MD5 hash.
std::string getHash() final
Retrieves the calculated MD5 hash value as a string.
void update(const unsigned char *input, std::size_t length) final
Updates the internal state of the hasher with new data.
LHASH_EXPORT std::string md5(const char *input, std::size_t length)
Calculates an MD5 hash for the given data.
LHASH_EXPORT std::string md5(std::string_view input)
Calculates an MD5 hash for the given string.
This file defines the hash::Hasher class and the hash::hash() free functions.
Cryptographic hash functions.