Murmur3 hash function implementation. More...
#include <hash-murmur3.h>
Public Member Functions | |
Murmur3 () | |
virtual void | clear (void) |
uint32_t | GetHash32 (const char *buffer, const size_t size) |
uint64_t | GetHash64 (const char *buffer, const size_t size) |
![]() | |
Implementation () | |
virtual | ~Implementation () |
![]() | |
SimpleRefCount () | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Private Types | |
enum | seed { SEED = 0x8BADF00D } |
Private Attributes | |
uint32_t | m_hash32 |
uint32_t | m_size32 |
uint64_t | m_hash64 [2] |
uint64_t | m_size64 |
Additional Inherited Members | |
![]() | |
static void | Cleanup (void) |
Murmur3 hash function implementation.
Adapted from http://code.google.com/p/smhasher/
MurmurHash3 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code.
Note - The x86 and x64 versions do not produce the same results, as the algorithms are optimized for their respective platforms. You can still compile and run any of them on any platform, but your performance with the non-native version will be less than optimal.
Definition at line 47 of file hash-murmur3.h.
|
private |
Seed value
This has to be a constant for all MPI ranks to generate the same hash from the same string.
Enumerator | |
---|---|
SEED |
Definition at line 96 of file hash-murmur3.h.
ns3::Hash::Function::Murmur3::Murmur3 | ( | ) |
Constructor, clears internal state
Definition at line 432 of file hash-murmur3.cc.
References clear().
|
virtual |
Restore initial state
Implements ns3::Hash::Implementation.
Definition at line 480 of file hash-murmur3.cc.
References m_hash32, m_hash64, m_size32, m_size64, and SEED.
Referenced by Murmur3().
|
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 |
Implements ns3::Hash::Implementation.
Definition at line 438 of file hash-murmur3.cc.
References m_hash32, m_size32, ns3::Hash::Function::Murmur3Implementation::MurmurHash3_x86_32_fin(), and ns3::Hash::Function::Murmur3Implementation::MurmurHash3_x86_32_incr().
|
virtual |
Compute 64-bit hash of a byte buffer.
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 from ns3::Hash::Implementation.
Definition at line 451 of file hash-murmur3.cc.
References m_hash64, m_size64, ns3::Hash::Function::Murmur3Implementation::MurmurHash3_x86_128_fin(), and ns3::Hash::Function::Murmur3Implementation::MurmurHash3_x86_128_incr().
|
private |
Cache last hash value, and total bytes hashed (needed to finalize), for incremental hashing
Definition at line 105 of file hash-murmur3.h.
Referenced by clear(), and GetHash32().
|
private |
murmur3 produces 128-bit hash and state; we use just the first 64-bits.
Definition at line 108 of file hash-murmur3.h.
Referenced by clear(), and GetHash64().
|
private |
Cache last hash value, and total bytes hashed (needed to finalize), for incremental hashing
Definition at line 106 of file hash-murmur3.h.
Referenced by clear(), and GetHash32().
|
private |
Cache last hash value, and total bytes hashed (needed to finalize), for incremental hashing
Definition at line 109 of file hash-murmur3.h.
Referenced by clear(), and GetHash64().