19 #include <string_view>
21 #include "lhashes/lhashes_Export.h"
39 enum class LHASH_EXPORT Type
78 virtual void update (
const unsigned char* input, std::size_t length) = 0;
80 virtual void update (std::string_view input);
94 [[nodiscard]]
virtual std::string
getHash() = 0;
112 [[nodiscard]] LHASH_EXPORT std::string
hash (Type type,
const char* input, std::size_t length);
119 [[nodiscard]] LHASH_EXPORT std::string
hash (Type type, std::string_view input);
A base class representing an object that calculates a hash function.
LHASH_EXPORT std::unique_ptr< Hasher > createHasherForType(Type type)
Creates an appropriate Hasher for the given Type.
virtual void update(std::string_view input)
Updates the internal state of the hasher with some new data.
LHASH_EXPORT std::string hash(Type type, std::string_view input)
Calculates a hash value for the input data using a hasher appropriate for the desired type.
LHASH_EXPORT std::string hash(Type type, const char *input, std::size_t length)
Calculates a hash value for the input data using a hasher appropriate for the desired type.
virtual std::string getHash()=0
Retrieves the calculated hash value as a string.
virtual std::size_t getLengthOfHash() const =0
Returns the length of a hash string for this algorithm.
virtual ~Hasher()=default
Destructor.
virtual void update(const unsigned char *input, std::size_t length)=0
Updates the internal state of the hasher with some new data.
Cryptographic hash functions.