docs: sanitize
[awesomized/libmemcached] / docs / source / libmemcached / memcached_generate_hash_value.rst
1 Generating hash values directly
2 ===============================
3
4 .. index:: object: memcached_st
5
6 Hash a key value
7
8 SYNOPSIS
9 --------
10
11 #include <libmemcached/memcached.h>
12
13 .. type:: memcached_hash_t
14
15 .. function:: uint32_t memcached_generate_hash_value (const char *key, size_t key_length, memcached_hash_t hash_algorithm)
16
17 .. function:: uint32_t memcached_generate_hash (memcached_st *ptr, const char *key, size_t key_length)
18
19 .. type:: MEMCACHED_HASH_DEFAULT
20
21 .. type:: MEMCACHED_HASH_MD5
22
23 .. type:: MEMCACHED_HASH_CRC
24
25 .. type:: MEMCACHED_HASH_FNV1_64
26
27 .. type:: MEMCACHED_HASH_FNV1A_64
28
29 .. type:: MEMCACHED_HASH_FNV1_32
30
31 .. type:: MEMCACHED_HASH_FNV1A_32
32
33 .. type:: MEMCACHED_HASH_JENKINS
34
35 .. type:: MEMCACHED_HASH_MURMUR
36
37 .. type:: MEMCACHED_HASH_HSIEH
38
39 .. type:: MEMCACHED_HASH_MURMUR3
40
41 Compile and link with -lmemcachedutil -lmemcached
42
43 DESCRIPTION
44 -----------
45
46 :func:`memcached_generate_hash_value` allows you to hash a key using one of
47 the hash functions defined in the library. This method is provided for
48 the convenience of higher-level language bindings and is not necessary
49 for normal memcache operations.
50
51 The allowed hash algorithm constants are listed in the manpage for
52 :func:`memcached_behavior_set`.
53
54 :func:`memcached_generate_hash` takes a :type:`memcached_st` structure
55 and produces the hash value that would have been generated based on the
56 defaults of :type:`memcached_st`.
57
58 As of version 0.36 all hash methods have been placed into the library
59 libhashkit(3) which is linked with libmemcached(3). For more information please see its documentation.
60
61 RETURN VALUE
62 ------------
63
64 A 32-bit integer which is the result of hashing the given key.
65 For 64-bit hash algorithms, only the least-significant 32 bits are
66 returned.
67
68 SEE ALSO
69 --------
70
71 .. only:: man
72
73 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`