.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MEMCACHED_GENERATE_HASH" "3" "Mar 11, 2024" "1.1" "libmemcached-awesome" .SH NAME memcached_generate_hash \- Generating hash values directly .sp Hash a key value .SH SYNOPSIS .INDENT 0.0 .TP .B #include Compile and link with \-lmemcachedutil \-lmemcached .UNINDENT .INDENT 0.0 .TP .B uint32_t memcached_generate_hash_value(const char *key, size_t key_length, \fI\%memcached_hash_t\fP hash_algorithm) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBkey\fP \-\- the key to generate a hash of .IP \(bu 2 \fBkey_length\fP \-\- the length of the \fI\%key\fP without any terminating zero .IP \(bu 2 \fBhash_algorithm\fP \-\- \fI\%memcached_hash_t\fP, the algorithm to use .UNINDENT .TP .B Returns a 32 bit hash value .UNINDENT .UNINDENT .INDENT 0.0 .TP .B uint32_t memcached_generate_hash(\fI\%memcached_st\fP *ptr, const char *key, size_t key_length) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBptr\fP \-\- pointer to an initialized \fI\%memcached_st\fP struct .IP \(bu 2 \fBkey\fP \-\- the key to generate a hash of .IP \(bu 2 \fBkey_length\fP \-\- the length of the \fI\%key\fP without any terminating zero .UNINDENT .TP .B Returns a 32 bit hash value .UNINDENT .UNINDENT .INDENT 0.0 .TP .B typedef enum \fI\%memcached_hash_t\fP memcached_hash_t .UNINDENT .INDENT 0.0 .TP .B enum memcached_hash_t .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_DEFAULT .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_MD5 .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_CRC .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_FNV1_64 .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_FNV1A_64 .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_FNV1_32 .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_FNV1A_32 .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_HSIEH .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_MURMUR .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_JENKINS .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_MURMUR3 .UNINDENT .INDENT 7.0 .TP .B enumerator MEMCACHED_HASH_CUSTOM .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fI\%memcached_generate_hash_value()\fP allows you to hash a key using one of the hash functions defined in the library. This method is provided for the convenience of higher\-level language bindings and is not necessary for normal memcache operations. .sp Support for \fI\%MEMCACHED_HASH_HSIEH\fP 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. .sp \fI\%memcached_generate_hash()\fP takes a \fI\%memcached_st\fP structure and produces the hash value that would have been generated based on the defaults of \fI\%memcached_st\fP\&. .sp 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. .SH RETURN VALUE .sp 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. .SH SEE ALSO .sp \fBmemcached(1)\fP \fBlibmemcached(3)\fP \fBmemcached_strerror(3)\fP .\" Generated by docutils manpage writer. .