File: hash.h

package info (click to toggle)
spamprobe 1.0a-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,028 kB
  • ctags: 1,006
  • sloc: cpp: 7,631; sh: 835; ansic: 346; ruby: 178; lisp: 73; makefile: 59
file content (31 lines) | stat: -rw-r--r-- 777 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _jenkinshash_h
#define _jenkinshash_h

#ifdef __cplusplus
extern "C" {
#endif

/*
  By Bob Jenkins, 1996.  bob_jenkins@burtleburtle.net.  You may use this
  code any way you wish, private, educational, or commercial.  It's free.

  See http://burtleburtle.net/bob/hash/evahash.html
  Use for hash table lookup, or anything where one collision in 2^^32 is
  acceptable.  Do NOT use for cryptographic purposes.
*/

typedef  unsigned long  int  ub4;   /* unsigned 4-byte quantities */
typedef  unsigned       char ub1;   /* unsigned 1-byte quantities */

#define hashsize(n) ((ub4)1<<(n))
#define hashmask(n) (hashsize(n)-1)

ub4 jenkins_hash(const ub1 *k,
                 ub4 length,
                 ub4 initval);

#ifdef __cplusplus
}
#endif

#endif // _jenkinshash_h