1 ===============================
2 Generating hash values directly
3 ===============================
5 .. index:: object: memcached_st
12 #include <libmemcached/memcached.h>
14 .. type:: memcached_hash_t
16 .. function:: uint32_t memcached_generate_hash_value (const char *key, size_t key_length, memcached_hash_t hash_algorithm)
18 .. function:: uint32_t memcached_generate_hash (memcached_st *ptr, const char *key, size_t key_length)
20 .. type:: MEMCACHED_HASH_DEFAULT
22 .. type:: MEMCACHED_HASH_MD5
24 .. type:: MEMCACHED_HASH_CRC
26 .. type:: MEMCACHED_HASH_FNV1_64
28 .. type:: MEMCACHED_HASH_FNV1A_64
30 .. type:: MEMCACHED_HASH_FNV1_32
32 .. type:: MEMCACHED_HASH_FNV1A_32
34 .. type:: MEMCACHED_HASH_JENKINS
36 .. type:: MEMCACHED_HASH_MURMUR
38 .. type:: MEMCACHED_HASH_HSIEH
40 .. type:: MEMCACHED_HASH_MURMUR3
42 Compile and link with -lmemcachedutil -lmemcached
48 :func:`memcached_generate_hash_value` allows you to hash a key using one of
49 the hash functions defined in the library. This method is provided for
50 the convenience of higher-level language bindings and is not necessary
51 for normal memcache operations.
53 The allowed hash algorithm constants are listed in the manpage for
54 :func:`memcached_behavior_set`.
56 :func:`memcached_generate_hash` takes a :type:`memcached_st` structure
57 and produces the hash value that would have been generated based on the
58 defaults of :type:`memcached_st`.
60 As of version 0.36 all hash methods have been placed into the library
61 libhashkit(3) which is linked with libmemcached(3). For more information please see its documentation.
67 A 32-bit integer which is the result of hashing the given key.
68 For 64-bit hash algorithms, only the least-significant 32 bits are
77 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`