src
CondFormats
Common
interface
hash64.h
Go to the documentation of this file.
1
#ifndef CondCommon_Hash64_h
2
#define CondCommon_Hash64_h
3
4
namespace
cond
{
5
6
/*
7
--------------------------------------------------------------------
8
lookup8.c, by Bob Jenkins, January 4 1997, Public Domain.
9
hash(), hash2(), hash3, and mix() are externally useful functions.
10
Routines to test the hash are included if SELF_TEST is defined.
11
You can use this free for any purpose. It has no warranty.
12
--------------------------------------------------------------------
13
*/
14
15
/*
16
--------------------------------------------------------------------
17
hash() -- hash a variable-length key into a 64-bit value
18
k : the key (the unaligned variable-length array of bytes)
19
len : the length of the key, counting by bytes
20
level : can be any 8-byte value
21
Returns a 64-bit value. Every bit of the key affects every bit of
22
the return value. No funnels. Every 1-bit and 2-bit delta achieves
23
avalanche. About 41+5len instructions.
24
25
The best hash table sizes are powers of 2. There is no need to do
26
mod a prime (mod is sooo slow!). If you need less than 64 bits,
27
use a bitmask. For example, if you need only 10 bits, do
28
h = (h & hashmask(10));
29
In which case, the hash table should have hashsize(10) elements.
30
31
If you are hashing n strings (ub1 **)k, do it like this:
32
for (i=0, h=0; i<n; ++i) h = hash( k[i], len[i], h);
33
34
By Bob Jenkins, Jan 4 1997. bob_jenkins@burtleburtle.net. You may
35
use this code any way you wish, private, educational, or commercial,
36
but I would appreciate if you give me credit.
37
38
See http://burtleburtle.net/bob/hash/evahash.html
39
Use for hash table lookup, or anything where one collision in 2^^64
40
is acceptable. Do NOT use for cryptographic purposes.
41
--------------------------------------------------------------------
42
*/
43
/*
44
--------------------------------------------------------------------
45
This is identical to hash() on little-endian machines, and it is much
46
faster than hash(), but a little slower than hash2(), and it requires
47
-- that all your machines be little-endian, for example all Intel x86
48
chips or all VAXen. It gives wrong results on big-endian machines.
49
--------------------------------------------------------------------
50
*/
51
52
unsigned
long
long
hash64
(
unsigned
char
*
k
,
unsigned
long
long
length,
unsigned
long
long
level
);
53
54
}
// namespace cond
55
#endif
cond::hash64
unsigned long long hash64(unsigned char *k, unsigned long long length, unsigned long long level)
Definition:
hash64.cc:68
personalPlayback.level
level
Definition:
personalPlayback.py:22
cond
Definition:
plugin.cc:23
dqmdumpme.k
k
Definition:
dqmdumpme.py:60
Generated for CMSSW Reference Manual by
1.8.14