lhashes
1.0.0
C++ hashes library
|
A base class representing an object that calculates a hash function. More...
#include <lhashes_hash.h>
Public Member Functions | |
virtual | ~Hasher ()=default |
Destructor. More... | |
virtual std::string | getHash ()=0 |
Retrieves the calculated hash value as a string. More... | |
virtual std::size_t | getLengthOfHash () const =0 |
Returns the length of a hash string for this algorithm. More... | |
Appending data to be hashed | |
virtual void | update (const unsigned char *input, std::size_t length)=0 |
Updates the internal state of the hasher with some new data. More... | |
virtual void | update (std::string_view input) |
Updates the internal state of the hasher with some new data. More... | |
Related Functions | |
(Note that these are not member functions.) | |
LHASH_EXPORT std::unique_ptr< Hasher > | createHasherForType (Type type) |
Creates an appropriate Hasher for the given Type. More... | |
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. More... | |
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. More... | |
A base class representing an object that calculates a hash function.
You should call the update()
method with any data that needs to be hashed, and then call getHash()
to finalize the internal calculations and retrieve the final hash value.
You shouldn't call update()
again after calling getHash()
.
You should use this class by either creating one of the hash function-specific supertypes, or through createHasherForType()
, such as:
Definition at line 68 of file lhashes_hash.h.
|
virtualdefault |
Destructor.
|
pure virtual |
Retrieves the calculated hash value as a string.
You shouldn't call update()
again after calling this function.
update()
should have been called at least once before calling this function.update()
should not be called again after calling this function.update()
. The string will be the length returned by getLengthOfHash()
. Implemented in limes::hash::SHA512, limes::hash::SHA384, limes::hash::SHA256, limes::hash::SHA224, limes::hash::SHA1, and limes::hash::MD5.
|
pure virtual |
Returns the length of a hash string for this algorithm.
Implemented in limes::hash::SHA512, limes::hash::SHA384, limes::hash::SHA256, limes::hash::SHA224, limes::hash::SHA1, and limes::hash::MD5.
|
pure virtual |
Updates the internal state of the hasher with some new data.
Implemented in limes::hash::SHA224, limes::hash::MD5, limes::hash::SHA512, limes::hash::SHA384, limes::hash::SHA256, and limes::hash::SHA1.
|
virtual |
Updates the internal state of the hasher with some new data.
|
related |
|
related |
Calculates a hash value for the input data using a hasher appropriate for the desired type.
|
related |
Calculates a hash value for the input data using a hasher appropriate for the desired type.