mptcpd
Multipath TCP Daemon
Loading...
Searching...
No Matches
murmur_hash.c File Reference
Include dependency graph for murmur_hash.c:

Macros

#define FORCE_INLINE   inline
#define FALLTHROUGH

Functions

unsigned int mptcpd_murmur_hash3 (void const *key, int len, uint32_t seed)
 Generate hash of key using the MurmurHash3 algorithm.

Detailed Description

This file incorporates work covered by the following notice: MurmurHash3 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code.

Changes relative to the original:

  • 128 bit hash functions were removed. They are not needed by mptcpd since the ELL l_hashmap expects hash values of type unsigned int.
  • The MurmurHash3_x86_32() function was renamed to mptcpd_murmur_hash3().
  • The hash value is returned as an unsigned int return value instead of a function "out" parameter of type void*.
  • The only compiler-specific support left in place is for gcc and clang.
  • Declare inline functions as static inline.
  • The coding style was modified to conform to the mptcpd style.
  • gcc "implicit fallthrough" warnings for switch statement were silenced.
See also
https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp

Function Documentation

◆ mptcpd_murmur_hash3()

unsigned int mptcpd_murmur_hash3 ( void const * key,
int len,
uint32_t seed )

Generate hash of key using the MurmurHash3 algorithm.

Parameters
[in]keyKey value to be hashed.
[in]lenLength of key in bytes.
[in]seedInitial value of hash prior to hashing key.
Returns
Hash of key.
Attention
The generated hash value is not cryptographically strong.
See also
https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp