Bernstein hash djb2ΒΆ
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:
The magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.
Parameters
buf: | input buffer to hash |
---|---|
len: | length of buffer |