Hash function implementation base class. More...
#include "hash-function.h"
Public Member Functions | |
Implementation () | |
Constructor. More... | |
virtual | ~Implementation () |
Destructor. More... | |
virtual void | clear ()=0 |
Restore initial state. More... | |
virtual uint32_t | GetHash32 (const char *buffer, const std::size_t size)=0 |
Compute 32-bit hash of a byte buffer. More... | |
virtual uint64_t | GetHash64 (const char *buffer, const std::size_t size) |
Compute 64-bit hash of a byte buffer. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Implementation > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Hash function implementation base class.
Definition at line 49 of file hash-function.h.
|
inline |
Constructor.
Definition at line 92 of file hash-function.h.
|
inlinevirtual |
Destructor.
Definition at line 99 of file hash-function.h.
|
pure virtual |
Restore initial state.
Implemented in ns3::Hash::Function::Murmur3, ns3::Hash::Function::Hash64, ns3::Hash::Function::Hash32, and ns3::Hash::Function::Fnv1a.
|
pure virtual |
Compute 32-bit hash of a byte buffer.
Call clear() between calls to GetHash32() to reset the internal state and hash each buffer separately.
If you don't call clear() between calls to GetHash32, you can hash successive buffers. The final return value will be the cumulative hash across all calls.
[in] | buffer | Pointer to the beginning of the buffer. |
[in] | size | Length of the buffer, in bytes. |
Implemented in ns3::Hash::Function::Murmur3, ns3::Hash::Function::Hash64, and ns3::Hash::Function::Hash32.
Referenced by GetHash64().
|
virtual |
Compute 64-bit hash of a byte buffer.
Default implementation returns 32-bit hash, with a warning.
Call clear() between calls to GetHash64() to reset the internal state and hash each buffer separately.
If you don't call clear() between calls to GetHash64, you can hash successive buffers. The final return value will be the cumulative hash across all calls.
[in] | buffer | Pointer to the beginning of the buffer. |
[in] | size | Length of the buffer, in bytes. |
Reimplemented in ns3::Hash::Function::Murmur3, and ns3::Hash::Function::Hash64.
Definition at line 39 of file hash-function.cc.
References GetHash32(), and NS_LOG_WARN.