1MEMCACHED_GENERATE_HASH(3) libmemcached-awesome MEMCACHED_GENERATE_HASH(3)
2
3
4
6 memcached_generate_hash - Generating hash values directly
7
8 Hash a key value
9
11 #include <libmemcached/memcached.h>
12 Compile and link with -lmemcachedutil -lmemcached
13
14 uint32_t memcached_generate_hash_value(const char *key, size_t
15 key_length, memcached_hash_t hash_algorithm)
16
17 Parameters
18
19 • key -- the key to generate a hash of
20
21 • key_length -- the length of the key without any termi‐
22 nating zero
23
24 • hash_algorithm -- memcached_hash_t, the algorithm to
25 use
26
27 Returns
28 a 32 bit hash value
29
30 uint32_t memcached_generate_hash(memcached_st *ptr, const char *key,
31 size_t key_length)
32
33 Parameters
34
35 • ptr -- pointer to an initialized memcached_st struct
36
37 • key -- the key to generate a hash of
38
39 • key_length -- the length of the key without any termi‐
40 nating zero
41
42 Returns
43 a 32 bit hash value
44
45 typedef enum memcached_hash_t memcached_hash_t
46
47 enum memcached_hash_t
48
49 enumerator MEMCACHED_HASH_DEFAULT
50
51 enumerator MEMCACHED_HASH_MD5
52
53 enumerator MEMCACHED_HASH_CRC
54
55 enumerator MEMCACHED_HASH_FNV1_64
56
57 enumerator MEMCACHED_HASH_FNV1A_64
58
59 enumerator MEMCACHED_HASH_FNV1_32
60
61 enumerator MEMCACHED_HASH_FNV1A_32
62
63 enumerator MEMCACHED_HASH_HSIEH
64
65 enumerator MEMCACHED_HASH_MURMUR
66
67 enumerator MEMCACHED_HASH_JENKINS
68
69 enumerator MEMCACHED_HASH_MURMUR3
70
71 enumerator MEMCACHED_HASH_CUSTOM
72
74 memcached_generate_hash_value() allows you to hash a key using one of
75 the hash functions defined in the library. This method is provided for
76 the convenience of higher-level language bindings and is not necessary
77 for normal memcache operations.
78
79 Support for MEMCACHED_HASH_HSIEH is a compile time option that is dis‐
80 abled by default. To enable tests for this hashing algorithm, configure
81 and build libmemcached with the Hsieh hash enabled.
82
83 memcached_generate_hash() takes a memcached_st structure and produces
84 the hash value that would have been generated based on the defaults of
85 memcached_st.
86
87 As of version 0.36 all hash methods have been placed into the library
88 libhashkit(3) which is linked with libmemcached(3). For more informa‐
89 tion please see its documentation.
90
92 A 32-bit integer which is the result of hashing the given key. For
93 64-bit hash algorithms, only the least-significant 32 bits are re‐
94 turned.
95
97 memcached(1) libmemcached(3) memcached_strerror(3)
98
99
100
101
1021.1 Nov 09, 2022 MEMCACHED_GENERATE_HASH(3)