2 * Fowler / Noll / Vo Hash (FNV Hash)
3 * http://www.isthe.com/chongo/tech/comp/fnv/
5 * This is an implementation of the algorithms posted above.
6 * This file is placed in the public domain by Peter Wemm.
8 * $FreeBSD: src/sys/sys/fnv_hash.h,v 1.2.2.1 2001/03/21 10:50:59 peter Exp $
11 #ifndef _SYS_FNV_HASH_H_
12 #define _SYS_FNV_HASH_H_
15 #include <sys/types.h>
18 typedef u_int32_t Fnv32_t;
20 #define FNV1_32_INIT ((Fnv32_t) 33554467UL)
21 #define FNV_32_PRIME ((Fnv32_t) 0x01000193UL)
23 static __inline Fnv32_t
24 fnv_32_buf(const void *buf, size_t len, Fnv32_t hval)
26 const u_int8_t *s = (const u_int8_t *)buf;
35 /* currently unused */
37 static __inline Fnv32_t
38 fnv_32_str(const char *str, Fnv32_t hval)
40 const u_int8_t *s = (const u_int8_t *)str;
43 while ((c = *s++) != 0) {
51 #endif /* !_SYS_FNV_HASH_H_ */