cHasher Class Reference

API: cHasher Class Reference
API
cHasher Class Reference
Inheritance diagram for cHasher:
[legend]

Public Member Functions

 cHasher ()
Updating the hash
Obtaining the result
uint32_t getHash () const
uint32_t parse (const char *hash) const
bool equals (const char *hash) const
std::string str () const

Description

Utility class to calculate the hash of some data.

We are trying to achieve that the same calls gives the same hash on a 32-bit machine and on a 64-bit machine. Longs can be either 32-bit or 64-bit, so we always convert them to 64 bits. We do not try to convert endianness, it would be too costly.

Constructor & Destructor Documentation

◆ cHasher()

cHasher ( )
inline

Constructor.

Member Function Documentation

◆ getHash()

uint32_t getHash ( ) const
inline

Returns the hash value.

◆ parse()

uint32_t parse ( const char * hash) const

Converts the given string to a numeric hash value. The object is not changed. Throws an error if the string does not contain a valid hash.

◆ equals()

bool equals ( const char * hash) const

Parses the given hash string, and compares it to the stored hash.

◆ str()

std::string str ( ) const

Returns the textual representation (hex string) of the stored hash.