Utility class to calculate the "fingerprint" of a simulation. More...
#include <chasher.h>
Public Member Functions | |
cHasher () | |
Updating the hash | |
void | reset () |
void | add (const char *p, size_t length) |
void | add (char d) |
void | add (short d) |
void | add (int d) |
void | add (long d) |
void | add (opp_long_long d) |
void | add (unsigned char d) |
void | add (unsigned short d) |
void | add (unsigned int d) |
void | add (unsigned long d) |
void | add (opp_unsigned_long_long d) |
void | add (double d) |
void | add (const char *s) |
Obtaining the result | |
uint32 | getHash () const |
uint32 | parse (const char *fingerprint) const |
bool | equals (const char *fingerprint) const |
std::string | str () const |
Utility class to calculate the "fingerprint" of a simulation.
We are trying to achieve that the same simulation gives the same fingerprint 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.
uint32 cHasher::parse | ( | const char * | fingerprint | ) | const |
Converts the given string to a numeric fingerprint value.
The object is not changed. Throws an error if the string does not contain a valid fingerprint.