MEMCACHED_GENERATE_HASH_VALUE(3)
π MEMCACHED_GENERATE_HASH_VALUE β a.k.a. memcached_generate_hash_value π
okay bestie so you're in the libmemcached-awesome manual, section 3, and today's main character is memcached_generate_hash_value β¨ buckle up, it's giving hash-core π¦
β¨ NAME β¨
memcached_generate_hash_value β generating hash values directly, bestie. like, hashing a key value yourself, on purpose, with your whole chest π
πΈ 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 β the receipts π
keyβ the key you wanna generate a hash of, no capkey_lengthβ the length of the key, and note it's without any terminating zero π«Άhash_algorithmβ amemcached_hash_t, aka which algorithm you're picking, choose wisely β¨
Returns β a 32 bit hash value π
uint32_t memcached_generate_hash(memcached_st *ptr, const char *key,
size_t key_length)
Parameters β round two, keep up π
ptrβ pointer to an initializedmemcached_ststruct, initialized being the key word bestie πkeyβ the key to generate a hash of (yes again, iconic)key_lengthβ the length of the key, again without any terminating zero
Returns β a 32 bit hash value π
typedef enum memcached_hash_t memcached_hash_t
enum memcached_hash_t
The whole roster, in order, no skips π:
- 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 π¦
so memcached_generate_hash_value() lets you hash a key using one of the hash functions defined in the library π It's literally there for the convenience of higher-level language bindings β it is not necessary for normal memcache operations, so don't come for me if you never touch it, it's fine, live your life π
π¨ heads up bestie: support for MEMCACHED_HASH_HSIEH is a compile time option that is disabled by default. To enable tests for this hashing algorithm, configure and build libmemcached with the Hsieh hash enabled. it's giving "opt-in only" energy β¨
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 β like, it's not inventing anything new, it's matching the vibe of your struct π«Ά
and a lil history moment for you: 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. slay, they got their own house π β¨
π RETURN VALUE π
A 32-bit integer which is the result of hashing the given key. and here's the fine print, don't skip it π β for 64-bit hash algorithms, only the least-significant 32 bits are returned. so if you were expecting all 64, you're getting the bottom half, periodt π
π₯ SEE ALSO π₯
and that's the whole page bestie, you ate that π this was libmemcached-awesome, version 1.1, dated Jul 24, 2025 β go forth and hash responsibly, mwah ππ§
π¦ 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