BloombergLP::bdlb::HashUtil::hash1

Return a 32-bit hash value for the specified data of the specified length.

Synopsis

Declared in <bdlb_hashutil.h>

static
unsigned int
hash1(
    char const* data,
    int length);

Description

Return an unsigned integer hash value corresponding to the specified data of the specified length (in bytes). The behavior is undefined unless 0 <= length. Note that if data is 0, then length also must be 0. Also note that every byte in data is significant; that is, it is not appropriate to cast a struct address to a char * unless the struct is packed (no padding).

Both hash1 and hash2 return a hash, but both hashes can be assumed to be independent (i.e., there are no known correlations between the results of the two hash functions given the same input data).

Return Value

32-bit hash value for data

Parameters

NameDescription
databytes to hash
lengthnumber of bytes in data