2 * Copyright (C) 2010 Brian Aker
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
9 #include <libhashkit/common.h>
11 uint32_t hashkit_digest(const hashkit_st
*self
, const char *key
, size_t key_length
)
13 return self
->base_hash
.function(key
, key_length
, self
->base_hash
.context
);
16 uint32_t libhashkit_digest(const char *key
, size_t key_length
, hashkit_hash_algorithm_t hash_algorithm
)
18 switch (hash_algorithm
)
20 case HASHKIT_HASH_DEFAULT
:
21 return libhashkit_one_at_a_time(key
, key_length
);
22 case HASHKIT_HASH_MD5
:
23 return libhashkit_md5(key
, key_length
);
24 case HASHKIT_HASH_CRC
:
25 return libhashkit_crc32(key
, key_length
);
26 case HASHKIT_HASH_FNV1_64
:
27 return libhashkit_fnv1_64(key
, key_length
);
28 case HASHKIT_HASH_FNV1A_64
:
29 return libhashkit_fnv1a_64(key
, key_length
);
30 case HASHKIT_HASH_FNV1_32
:
31 return libhashkit_fnv1_32(key
, key_length
);
32 case HASHKIT_HASH_FNV1A_32
:
33 return libhashkit_fnv1a_32(key
, key_length
);
34 case HASHKIT_HASH_HSIEH
:
35 #ifdef HAVE_HSIEH_HASH
36 return libhashkit_hsieh(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
:
47 return libhashkit_jenkins(key
, key_length
);
48 case HASHKIT_HASH_CUSTOM
:
49 case HASHKIT_HASH_MAX
:
53 fprintf(stderr
, "hashkit_hash_t was extended but libhashkit_generate_value was not updated\n");