docs: flush libmemcached progress
[awesomized/libmemcached] / docs / source / libmemcached / memcached_generate_hash_value.rst
1 Generating hash values directly
2 ===============================
3
4 Hash a key value
5
6 SYNOPSIS
7 --------
8
9 #include <libmemcached/memcached.h>
10 Compile and link with -lmemcachedutil -lmemcached
11
12 .. function:: uint32_t memcached_generate_hash_value (const char *key, size_t key_length, memcached_hash_t hash_algorithm)
13
14 :param key: the key to generate a hash of
15 :param key_length: the length of the `key` without any terminating zero
16 :param hash_algorithm: `memcached_hash_t`, the algorithm to use
17 :returns: a 32 bit hash value
18
19 .. function:: uint32_t memcached_generate_hash (memcached_st *ptr, const char *key, size_t key_length)
20
21 :param ptr: pointer to an initialized `memcached_st` struct
22 :param key: the key to generate a hash of
23 :param key_length: the length of the `key` without any terminating zero
24 :returns: a 32 bit hash value
25
26 .. c:type:: enum memcached_hash_t memcached_hash_t
27
28 .. enum:: memcached_hash_t
29
30 .. enumerator:: MEMCACHED_HASH_DEFAULT
31
32 .. enumerator:: MEMCACHED_HASH_MD5
33
34 .. enumerator:: MEMCACHED_HASH_CRC
35
36 .. enumerator:: MEMCACHED_HASH_FNV1_64
37
38 .. enumerator:: MEMCACHED_HASH_FNV1A_64
39
40 .. enumerator:: MEMCACHED_HASH_FNV1_32
41
42 .. enumerator:: MEMCACHED_HASH_FNV1A_32
43
44 .. enumerator:: MEMCACHED_HASH_HSIEH
45
46 .. enumerator:: MEMCACHED_HASH_MURMUR
47
48 .. enumerator:: MEMCACHED_HASH_JENKINS
49
50 .. enumerator:: MEMCACHED_HASH_MURMUR3
51
52 .. enumerator:: MEMCACHED_HASH_CUSTOM
53
54
55
56 DESCRIPTION
57 -----------
58
59 :func:`memcached_generate_hash_value` allows you to hash a key using one of
60 the hash functions defined in the library. This method is provided for
61 the convenience of higher-level language bindings and is not necessary
62 for normal memcache operations.
63
64 Support for `MEMCACHED_HASH_HSIEH` is a compile time option that is
65 disabled by default. To enable tests for this hashing algorithm,
66 configure and build libmemcached with the Hsieh hash enabled.
67
68 :func:`memcached_generate_hash` takes a :type:`memcached_st` structure
69 and produces the hash value that would have been generated based on the
70 defaults of :type:`memcached_st`.
71
72 As of version 0.36 all hash methods have been placed into the library
73 libhashkit(3) which is linked with libmemcached(3). For more information please see its documentation.
74
75 RETURN VALUE
76 ------------
77
78 A 32-bit integer which is the result of hashing the given key.
79 For 64-bit hash algorithms, only the least-significant 32 bits are
80 returned.
81
82 SEE ALSO
83 --------
84
85 .. only:: man
86
87 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`