Quick Links: |
#include <bslh_defaulthashalgorithm.h>
Public Types | |
typedef InternalHashAlgorithm::result_type | result_type |
Public Member Functions | |
DefaultHashAlgorithm () | |
~DefaultHashAlgorithm () | |
void | operator() (const void *data, size_t numBytes) |
result_type | computeHash () |
This class wraps an unspecified default hashing algorithm that is appropriate for general purpose use such as generating hashes for a hash table.
See Component bslh_defaulthashalgorithm
bslh::DefaultHashAlgorithm::DefaultHashAlgorithm | ( | ) |
Create a bslh::DefaultHashAlgorithm
, default constructing the algorithm being used internally.
bslh::DefaultHashAlgorithm::~DefaultHashAlgorithm | ( | ) |
Destroy this object.
void bslh::DefaultHashAlgorithm::operator() | ( | const void * | data, | |
size_t | numBytes | |||
) |
Incorporate the specified data
, of at least the specified numBytes
, into the internal state of the hashing algorithm. Every bit of data incorporated into the internal state of the algorithm will contribute to the final hash produced by computeHash()
. The same hash will be produced regardless of whether a sequence of bytes is passed in all at once or through multiple calls to this member function. Input where numBytes
is 0 will have no effect on the internal state of the algorithm. The behaviour is undefined unless data
points to a valid memory location with at least numBytes
bytes of initialized memory or numBytes
is zero.
result_type bslh::DefaultHashAlgorithm::computeHash | ( | ) |
Return the finalized version of the hash that has been accumulated. Note that this changes the internal state of the object, so calling computeHash()
multiple times in a row will return different results, and only the first result returned will match the expected result of the algorithm. Also note that a value will be returned, even if data has not been passed into operator()