pub unsafe extern "C" fn djb2_hash(buf: *const u8, len: size_t) -> u32
Expand description
@defgroup sys_hashes_djb2 Bernstein hash djb2 @ingroup sys_hashes_non_crypto @brief djb2 hash algorithm.
HISTORY This algorithm (k=33) was first reported by Dan Bernstein many years ago in comp.lang.c. Another version of this algorithm (now favored by bernstein) uses XOR:
hash(i) = hash(i - 1) * 33 ^ str[i];
The magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.
@param buf input buffer to hash @param len length of buffer @return 32 bit sized hash