BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslh::SpookyHashAlgorithmImp Class Reference

#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 ()=default
 
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)
 

Detailed Description

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 bslh_spookyhashalgorithmimp

Member Typedef Documentation

◆ Uint16

typedef unsigned short bslh::SpookyHashAlgorithmImp::Uint16

◆ Uint32

◆ Uint64

◆ Uint8

typedef unsigned char bslh::SpookyHashAlgorithmImp::Uint8

Constructor & Destructor Documentation

◆ SpookyHashAlgorithmImp()

bslh::SpookyHashAlgorithmImp::SpookyHashAlgorithmImp ( Uint64  seed1,
Uint64  seed2 
)
inline

Create a bslh::SpookyHashAlgorithmImp, initializing the internal state of the object using the specified seed1 and seed2 as seeds for the algorithm.

◆ ~SpookyHashAlgorithmImp()

bslh::SpookyHashAlgorithmImp::~SpookyHashAlgorithmImp ( )
default

Member Function Documentation

◆ finalize()

void bslh::SpookyHashAlgorithmImp::finalize ( Uint64 hash1,
Uint64 hash2 
)

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.

◆ hash128()

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.

◆ hash32()

SpookyHashAlgorithmImp::Uint32 bslh::SpookyHashAlgorithmImp::hash32 ( const void *  message,
size_t  length,
Uint32  seed 
)
inlinestatic

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.

◆ hash64()

SpookyHashAlgorithmImp::Uint64 bslh::SpookyHashAlgorithmImp::hash64 ( const void *  message,
size_t  length,
Uint64  seed 
)
inlinestatic

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.

◆ update()

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.


The documentation for this class was generated from the following file: