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

#include <bslh_defaultseededhashalgorithm.h>

Public Types

enum  { k_SEED_LENGTH = InternalHashAlgorithm::k_SEED_LENGTH }
 Seed length in bytes. More...
 
typedef InternalHashAlgorithm::result_type result_type
 Typedef indicating the value type returned by this algorithm.
 

Public Member Functions

 BSLMF_ASSERT (0< k_SEED_LENGTH)
 
 DefaultSeededHashAlgorithm (const char *seed)
 
 ~DefaultSeededHashAlgorithm ()=default
 Destroy this object.
 
void operator() (const void *data, size_t numBytes)
 
result_type computeHash ()
 

Detailed Description

This class wraps an unspecified default hashing algorithm, which takes a seed, that is appropriate for general purpose use such as generating hashes for a hash table.

See bslh_defaultseededhashalgorithm

Member Typedef Documentation

◆ result_type

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
k_SEED_LENGTH 

Constructor & Destructor Documentation

◆ DefaultSeededHashAlgorithm()

bslh::DefaultSeededHashAlgorithm::DefaultSeededHashAlgorithm ( const char *  seed)
inlineexplicit

Create a bslh::DefaultSeededHashAlgorithm, seeded with the (k_SEED_LENGTH bytes) seed pointed to by the specified seed. Each bit of the supplied seed will contribute to the final hash produced by computeHash(). The behaviour is undefined unless seed points to at least k_SEED_LENGTH bytes of initialized memory.

◆ ~DefaultSeededHashAlgorithm()

bslh::DefaultSeededHashAlgorithm::~DefaultSeededHashAlgorithm ( )
default

Member Function Documentation

◆ BSLMF_ASSERT()

bslh::DefaultSeededHashAlgorithm::BSLMF_ASSERT ( )

◆ computeHash()

DefaultSeededHashAlgorithm::result_type bslh::DefaultSeededHashAlgorithm::computeHash ( )
inline

Return the finalized version of the hash that has been accumulated. Note that this changes the internal state of the object, so calling computeHash() multiple times in a row will return different results, and only the first result returned will match the expected result of the algorithm. Also note that a value will be returned, even if data has not been passed into operator().

◆ operator()()

void bslh::DefaultSeededHashAlgorithm::operator() ( const void *  data,
size_t  numBytes 
)
inline

Incorporate the specified data, of at least the specified numBytes, into the internal state of the hashing algorithm. Every bit of data incorporated into the internal state of the algorithm will contribute to the final hash produced by computeHash(). The same hash will be produced regardless of whether a sequence of bytes is passed in all at once or through multiple calls to this member function. Input where numBytes is 0 will have no effect on the internal state of the algorithm. The behaviour is undefined unless data points to a valid memory location with at least numBytes bytes of initialized memory or numBytes is zero.


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