UniqueHasher Class Reference

#include <hash.h>

Detailed Description

UniqueHasher allows to compute a 128-bit UniqueHash from a sequence of values. The values are passed to the hasher using a series of calls to Combine() functions. At the end, the Finalize() function returns the final hash value.

Computing the hash value through a series of calls is slower than a one-shot computation of a single byte block using UniqueHash::GetUniqueHashCode(). For better performance, you should prefer the one-shot computation if possible.

Public Types

using ValueType = UniqueHash
 

Public Member Functions

 UniqueHasher ()
 
void Combine (const Block< const Byte > &bytes)
 
void Combine (const Byte *ptr, Int count)
 
void Combine (const UniqueHash &value)
 
template<typename HASH = DefaultCompare, typename T >
void CombineHash (const T &value)
 
UniqueHash Finalize () const
 
 operator UniqueHash () const
 

Private Attributes

UInt64 _state [72]
 

Member Typedef Documentation

◆ ValueType

Member Function Documentation

◆ CombineHash()

void CombineHash ( const T &  value)

Mixes a hash value of the given value into the hasher state. If value's type T is trivially hashable, the raw bytes of value are used for mixing. Otherwise the hash value returned by {HASH::GetUniqueHashCode(value)} is used.

Parameters
[in]valueA hash value.

Member Data Documentation

◆ _state

UInt64 _state[72]
private