Peter Weinberger's non-cryptographic hash implemented as an inline function. More...
Functions | |
static uint32 | pjw_hash_seeded (const void *data, int32 datalen, uint32 hash) |
Combine a 32-bit PJW hash value from a byte buffer with an initial seed value. More... | |
static uint32 | pjw_hash (const void *data, int32 datalen) |
Get a 32-bit PJW hash value from a byte buffer. More... | |
Peter Weinberger's non-cryptographic hash implemented as an inline function.
This header file should ONLY be included by C files that use this hash function. Header files should not include this, if the hash function is not used by a source file that includes it, there will be warnings about unused static functions.
This simple hash function operates on a number of characters, in a single operation. If you need an incremental hash function, or a hash function that operates on larger units, or a hash function with better dispersion, try using Hsieh's SuperFastHash (hsiehhash32.h) or MurmurHash3 (murmurhash3.h).
Get a 32-bit PJW hash value from a byte buffer.
[in] | data | The data to hash. |
[in] | datalen | The number of 8-bit values to include in the hash key. If this is less than zero on entry, then the data is a zero-terminated string. |
Combine a 32-bit PJW hash value from a byte buffer with an initial seed value.
[in] | data | The data to hash. |
[in] | datalen | The number of 8-bit values to include in the hash key. If this is less than zero on entry, then the data is a zero-terminated string. |
[in] | hash | The seed value to use. |