MEMCACHED_GENERATE_HASH(3)
โจ NAME โจ
memcached_generate_hash โ generating hash values directly ๐
Hash a key value, bestie. That's the whole vibe.
๐ SYNOPSIS ๐
#include <libmemcached/memcached.h>
Compile and link with -lmemcachedutil -lmemcached
uint32_t memcached_generate_hash_value(const char *key, size_t
key_length, memcached_hash_t hash_algorithm)
Parameters ๐ซถ
keyโ the key to generate a hash ofkey_lengthโ the length of the key without any terminating zerohash_algorithmโmemcached_hash_t, the algorithm to use
Returns โ a 32 bit hash value โจ
uint32_t memcached_generate_hash(memcached_st *ptr, const char *key,
size_t key_length)
Parameters ๐ซถ
ptrโ pointer to an initializedmemcached_ststructkeyโ the key to generate a hash ofkey_lengthโ the length of the key without any terminating zero
Returns โ a 32 bit hash value โจ
typedef enum memcached_hash_t memcached_hash_t
enum memcached_hash_t
- enumerator
MEMCACHED_HASH_DEFAULT - enumerator
MEMCACHED_HASH_MD5 - enumerator
MEMCACHED_HASH_CRC - enumerator
MEMCACHED_HASH_FNV1_64 - enumerator
MEMCACHED_HASH_FNV1A_64 - enumerator
MEMCACHED_HASH_FNV1_32 - enumerator
MEMCACHED_HASH_FNV1A_32 - enumerator
MEMCACHED_HASH_HSIEH - enumerator
MEMCACHED_HASH_MURMUR - enumerator
MEMCACHED_HASH_JENKINS - enumerator
MEMCACHED_HASH_MURMUR3 - enumerator
MEMCACHED_HASH_CUSTOM
๐ DESCRIPTION ๐
Okay so memcached_generate_hash_value() lets you hash a key using one of the hash functions defined in the library. It's literally giving convenience for higher-level language bindings โ it is not necessary for normal memcache operations. So if you're just doing your regular memcache thing, you don't need this. It's a special-occasion slay. ๐
Support for MEMCACHED_HASH_HSIEH is a compile time option that is disabled by default, bestie. To enable tests for this hashing algorithm, configure and build libmemcached with the Hsieh hash enabled. No cap. ๐ง
memcached_generate_hash() takes a memcached_st structure and produces the hash value that would have been generated based on the defaults of memcached_st. It's likeโฆ peeking at the future your struct already decided on. ๐ฎ
As of version 0.36 all hash methods have been placed into the library libhashkit(3) which is linked with libmemcached(3). For more information please see its documentation. Go read it, it's iconic. ๐
๐ RETURN VALUE ๐
A 32-bit integer which is the result of hashing the given key. For 64-bit hash algorithms, only the least-significant 32 bits are returned. So yeah, you're getting the bottom half of the number โ that's just how it is, periodt. ๐
๐ฆ SEE ALSO ๐ฆ
k bye bestie ๐ this was libmemcached-awesome version 1.1, dated Jul 24, 2025. go hash something cute ๐โจ๐ซถ
๐ฆ where this page comes from
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 ยท BSD-3-Clause
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms