Lines Matching refs:hash
1 /* $NetBSD: hash.h,v 1.7 2012/07/08 01:24:08 rmind Exp $ */
38 #include <machine/hash.h>
41 #ifndef __HAVE_HASH32_BUF /* not overridden by MD hash */
47 * hash32_buf(const void *bf, size_t len, uint32_t hash)
48 * return a 32 bit hash of the binary buffer buf (size len),
49 * seeded with an initial hash value of hash (usually HASH32_BUF_INIT).
52 hash32_buf(const void *bf, size_t len, uint32_t hash)
57 hash = hash * 257 + *s++;
58 return (hash * 257);
63 #ifndef __HAVE_HASH32_STR /* not overridden by MD hash */
68 * hash32_str(const void *bf, uint32_t hash)
69 * return a 32 bit hash of NUL terminated ASCII string buf,
70 * seeded with an initial hash value of hash (usually HASH32_STR_INIT).
73 hash32_str(const void *bf, uint32_t hash)
79 hash = hash * 33 + c; /* "perl": k=33, r=r+r/32 */
80 return (hash + (hash >> 5));
85 * hash32_strn(const void *bf, size_t len, uint32_t hash)
86 * return a 32 bit hash of NUL terminated ASCII string buf up to
88 * seeded with an initial hash value of hash (usually HASH32_STR_INIT).
91 hash32_strn(const void *bf, size_t len, uint32_t hash)
97 hash = hash * 33 + c; /* "perl": k=33, r=r+r/32 */
98 return (hash + (hash >> 5));