2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
16 #include "libhashkit/common.h"
18 uint32_t hashkit_digest(const hashkit_st
*self
, const char *key
, size_t key_length
) {
19 return self
->base_hash
.function(key
, key_length
, self
->base_hash
.context
);
22 uint32_t libhashkit_digest(const char *key
, size_t key_length
,
23 hashkit_hash_algorithm_t hash_algorithm
) {
24 switch (hash_algorithm
) {
25 case HASHKIT_HASH_DEFAULT
: return libhashkit_one_at_a_time(key
, key_length
);
26 case HASHKIT_HASH_MD5
: return libhashkit_md5(key
, key_length
);
27 case HASHKIT_HASH_CRC
: return libhashkit_crc32(key
, key_length
);
28 case HASHKIT_HASH_FNV1_64
: return libhashkit_fnv1_64(key
, key_length
);
29 case HASHKIT_HASH_FNV1A_64
: return libhashkit_fnv1a_64(key
, key_length
);
30 case HASHKIT_HASH_FNV1_32
: return libhashkit_fnv1_32(key
, key_length
);
31 case HASHKIT_HASH_FNV1A_32
: return libhashkit_fnv1a_32(key
, key_length
);
32 case HASHKIT_HASH_HSIEH
:
33 #ifdef HAVE_HSIEH_HASH
34 return libhashkit_hsieh(key
, key_length
);
38 case HASHKIT_HASH_MURMUR3
: return libhashkit_murmur3(key
, key_length
);
40 case HASHKIT_HASH_MURMUR
:
41 #ifdef HAVE_MURMUR_HASH
42 return libhashkit_murmur(key
, key_length
);
46 case HASHKIT_HASH_JENKINS
: return libhashkit_jenkins(key
, key_length
);
47 case HASHKIT_HASH_CUSTOM
:
48 case HASHKIT_HASH_MAX
:
52 "hashkit_hash_t was extended but libhashkit_generate_value was not updated\n");