Quick Links: |
#include <bslh_spookyhashalgorithmimp.h>
Public Types | |
typedef bsls::Types::Uint64 | Uint64 |
typedef unsigned int | Uint32 |
typedef unsigned short | Uint16 |
typedef unsigned char | Uint8 |
Public Member Functions | |
SpookyHashAlgorithmImp (Uint64 seed1, Uint64 seed2) | |
~SpookyHashAlgorithmImp () | |
void | update (const void *message, size_t length) |
void | finalize (Uint64 *hash1, Uint64 *hash2) |
Static Public Member Functions | |
static Uint32 | hash32 (const void *message, size_t length, Uint32 seed) |
static Uint64 | hash64 (const void *message, size_t length, Uint64 seed) |
static void | hash128 (const void *message, size_t length, Uint64 *hash1, Uint64 *hash2) |
This class wraps an implementation of Bob Jenkin's "SpookyHash" in a BDE-style component. For more information, see http://burtleburtle.net/bob/hash/spooky.html .
See Component bslh_spookyhashalgorithmimp
typedef unsigned int bslh::SpookyHashAlgorithmImp::Uint32 |
typedef unsigned short bslh::SpookyHashAlgorithmImp::Uint16 |
typedef unsigned char bslh::SpookyHashAlgorithmImp::Uint8 |
Create a bslh::SpookyHashAlgorithmImp
, initializing the internal state of the object using the specified seed1
and seed2
as seeds for the algorithm.
bslh::SpookyHashAlgorithmImp::~SpookyHashAlgorithmImp | ( | ) |
Destroy this object.
static Uint32 bslh::SpookyHashAlgorithmImp::hash32 | ( | const void * | message, | |
size_t | length, | |||
Uint32 | seed | |||
) | [static] |
Hash the specified length
bytes of message
using seed
as a seed. Return the resulting 32-bit hash. The behavior is undefined unless message
points at least length
bytes of initialized memory or length
is zero.
static Uint64 bslh::SpookyHashAlgorithmImp::hash64 | ( | const void * | message, | |
size_t | length, | |||
Uint64 | seed | |||
) | [static] |
Hash the specified length
bytes of message
using seed
as a seed. Return the resulting 64-bit hash. The behavior is undefined unless message
points at least length
bytes of initialized memory or length
is zero.
static void bslh::SpookyHashAlgorithmImp::hash128 | ( | const void * | message, | |
size_t | length, | |||
Uint64 * | hash1, | |||
Uint64 * | hash2 | |||
) | [static] |
Hash the specified length
bytes of message
using hash1
and hash2
as seeds. Load the higher order bits of the resulting 128-bit hash value into hash1
and the lower order bits in hash2
. The behavior is undefined unless message
points at least length
bytes of initialized memory or length
is zero, and both hash1
and hash2
point to at least 8 bytes of initialized, modifiable, memory.
void bslh::SpookyHashAlgorithmImp::update | ( | const void * | message, | |
size_t | length | |||
) |
Accumulate the specified length
bytes of message
into the internal state of the algorithm. Accumulating bytes through Update
will produce the same result as hashing them all at once through the HashXX
static methods. The behavior is undefined unless message
points at least length
bytes of initialized memory or length
is zero.
Load the finalized hash into the specified hash1
and hash2
. hash1
will contain the higher order bits of the hash and hash2
will contain the lower order bits. The internal state of the algorithm will be modified, meaning that calling final multiple times will result in different hash values being returned. The returned hash will be the same as if Hash128
had been called will all of the accumulated data in one block. The behavior is undefined unless both hash1
and hash2
point to 8 bytes of modifiable memory. Note that a value will be returned even if update
has not been called.