Hash Function
UCX implements the MurmurHash2 algorithm for computing hashes that are primarily used for CxMap. But it can be used for arbitrary custom scenarios, too.
Overview
Description
The primary function for creating a CxHashKey
structure is cx_hash_key()
. The other functions do effectively the same, but
cx_hash_key_bytes()
is strongly typed if you want to avoid passingvoid*
cx_hash_key_str()
conveniently takes a C string and computes the lengthcx_hash_key_cxstr()
conveniently takes a UCX string
In all cases, the hash will be available in the hash
field of the returned structure.
If you want to create a hash completely manually, you can initialize the data
and len
members of CxHashKey
and call cx_hash_murmur()
. It is not recommended to do so.
Example that is equivalent to CxHashKey key = cx_hash_str(mystring)