#include <hash.h>
UniqueHash is used as return type of GetUniqueHashCode functions. It has a size of 128 bits. For reasonable hash code functions it's a practically safe assumption that there are no hash collisions, so one can consider such a hash to be unique.
Public Member Functions | |
| UniqueHash ()=default | |
| constexpr | UniqueHash (UInt64 l, UInt64 h) |
| Bool | operator== (const UniqueHash &other) const |
| Bool | operator!= (const UniqueHash &other) const |
| Bool | operator< (const UniqueHash &other) const |
| MAXON_OPERATOR_INEQUALITY (UniqueHash) | |
| HashInt | GetHashCode () const |
| const UniqueHash & | GetUniqueHashCode () const |
| constexpr UInt | operator& (UInt mask) const |
| String | ToString (const FormatStatement *fs=nullptr) const |
| Char * | WriteHex (Char *hexbuf) const |
| void | CombineUnordered (const UniqueHash &other) |
Static Public Member Functions | |
| static constexpr Bool | TriviallyHashable () |
| static Result< UniqueHash > | FromString (const String &str) |
| static UniqueHash | GetUniqueHashCode (const Byte *ptr, Int count) |
| static UniqueHash | GetUniqueHashCode (const Block< const Byte > &bytes) |
Public Attributes | |
| UInt64 | low |
| UInt64 | high |
Static Public Attributes | |
| static constexpr Int | HEXBUF_LENGTH |
|
default |
|
constexpr |
|
staticconstexpr |
| Bool operator== | ( | const UniqueHash & | other | ) | const |
| Bool operator!= | ( | const UniqueHash & | other | ) | const |
| Bool operator< | ( | const UniqueHash & | other | ) | const |
| MAXON_OPERATOR_INEQUALITY | ( | UniqueHash | ) |
| HashInt GetHashCode | ( | ) | const |
| const UniqueHash& GetUniqueHashCode | ( | ) | const |
Returns the bitwise and of the low bits of this UniqueHash and the given mask.
| [in] | mask | A bit mask. |
| String ToString | ( | const FormatStatement * | fs = nullptr | ) | const |
Returns this UniqueHash as a string of 32 hexadecimal digits in little endian order (least significant byte first).
|
static |
Parses hexadecimal string representation into a UniqueHash. str is expected to consist of exactly 32 hexadecimal digits in little endian order (least significant byte first).
| [in] | str | Hexadecimal string. |
Converts this UniqueHash to a Char string of HEXBUF_LENGTH (32) hexadecimal digits (little endian, least significant byte first).
| [out] | hexbuf | The Char string will be written to hexbuf (without null terminator). hexbuf has to provide space for at least HEXBUF_LENGTH characters. |
| void CombineUnordered | ( | const UniqueHash & | other | ) |
Combines the other UniqueHash with this UniqueHash in an unordered way, which means that the effect of multiple calls to CombineUnordered doesn't depend on the order of those calls. You can use this function to compute a UniqueHash of a sequence of UniqueHashes when the sequence order shall be irrelevant.
| [in] | other | Another UniqueHash. |
| UInt64 low |
The lower 64 bits of the UniqueHash.
| UInt64 high |
The higher 64 bits of the UniqueHash.
|
staticconstexpr |
Minimal size of hexbuf argument for WriteHex (number of hexadecimal digits of a UniqueHash).