1spooky_hash128(3)                                            spooky_hash128(3)
2
3
4

NAME

6       spooky_hash128 - generate a "spooky" hash of an arbitrary blob of data
7

SYNOPSIS

9       #include <spooky-c.h>
10
11       void spooky_hash128(const void *message, size_t len, uint64_t *hash1,
12       uint64_t *hash2);
13
14       uint64_t spooky_hash64(const void *message, size_t len, uint64_t seed);
15
16       uint32_t spooky_hash32(const void *message, size_t len, uint32_t seed);
17

DESCRIPTION

19       Quoting from Bob Jenkins' web page (inventor of the spooky hash
20       function):
21
22       "SpookyHash is a public domain noncryptographic hash function producing
23       well-distributed 128-bit hash values for byte arrays of any length."
24
25       It can also produce 64-bit and 32-bit hash values too, by simply
26       discarding the upper bits of the returned hash value. spooky_hash32 and
27       spooky_hash64 are wrappers around spooky_hash128 that do this
28       discarding.
29
30       The message is a pointer to the stream of bytes to be hashed. len is
31       the length of message. seed allows the function to generate different
32       hashes for the same key.
33
34       spooky_hash128 also accepts seed values in hash1 and hash2. Those
35       values will be overwritten with the actual hash results on return.
36

RETURN VALUE

38       spooky_hash64 and spooky_hash32 return the hash value directly.
39       spooky_hash128 is a void return function. It overwrites the two 64-bit
40       integers that hash1 and hash2 on return. These functions never return
41       errors, only hash values.
42

NOTES

44       The original code was written in C++. The spooky-c library is a
45       reimplementation of the hash function in C. It's quite fast on 64-bit
46       hardware.
47
48       There are some caveats with the SpookyHash function:
49
50       ·   It was written for little-endian machines. It will run and work on
51           big-endian machines as well, but it will produce different results.
52           Do not use these functions if you plan to distribute these hashes
53           in a mixed endianness environment.
54
55       ·   It is optimized for 64-bit machines that can do unaligned reads.
56           It will work on 32-bit hardware and on machines that require
57           aligned reads, but it won't perform as well on that hardware. You
58           may want to consider a different hash function in that situation.
59

SEE ALSO

61       Bob Jenkins' webpage on SpookyHash:
62       <http://www.burtleburtle.net/bob/hash/spooky.html>
63

AUTHORS

65       Bob Jenkins <bob_jenkins@burtleburtle.net> invented the SpookyHash
66       algorithm and wrote the original C++ implementation. The C
67       implementation (spooky-c) was written by Andi Kleen
68       <andi@firstfloor.org>. This manpage was authored by Jeff Layton
69       <jlayton@poochiereds.net>.
70
71
72
73                                  2015-03-30                 spooky_hash128(3)
Impressum