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
:
26 return libhashkit_one_at_a_time(key
, key_length
);
27 case HASHKIT_HASH_MD5
:
28 return libhashkit_md5(key
, key_length
);
29 case HASHKIT_HASH_CRC
:
30 return libhashkit_crc32(key
, key_length
);
31 case HASHKIT_HASH_FNV1_64
:
32 return libhashkit_fnv1_64(key
, key_length
);
33 case HASHKIT_HASH_FNV1A_64
:
34 return libhashkit_fnv1a_64(key
, key_length
);
35 case HASHKIT_HASH_FNV1_32
:
36 return libhashkit_fnv1_32(key
, key_length
);
37 case HASHKIT_HASH_FNV1A_32
:
38 return libhashkit_fnv1a_32(key
, key_length
);
39 case HASHKIT_HASH_HSIEH
:
40 #ifdef HAVE_HSIEH_HASH
41 return libhashkit_hsieh(key
, key_length
);
45 case HASHKIT_HASH_MURMUR3
:
46 return libhashkit_murmur3(key
, key_length
);
48 case HASHKIT_HASH_MURMUR
:
49 #ifdef HAVE_MURMUR_HASH
50 return libhashkit_murmur(key
, key_length
);
54 case HASHKIT_HASH_JENKINS
:
55 return libhashkit_jenkins(key
, key_length
);
56 case HASHKIT_HASH_CUSTOM
:
57 case HASHKIT_HASH_MAX
:
61 "hashkit_hash_t was extended but libhashkit_generate_value was not updated\n");