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 /* FNV hash'es lifted from Dustin Sallings work */
19 static uint32_t FNV_32_INIT
= 2166136261UL;
20 static uint32_t FNV_32_PRIME
= 16777619;
22 uint32_t hashkit_fnv1_32(const char *key
, size_t key_length
, void *context
) {
23 uint32_t hash
= FNV_32_INIT
;
26 for (size_t x
= 0; x
< key_length
; x
++) {
27 uint32_t val
= (uint32_t) key
[x
];
35 uint32_t hashkit_fnv1a_32(const char *key
, size_t key_length
, void *context
) {
36 uint32_t hash
= FNV_32_INIT
;
39 for (size_t x
= 0; x
< key_length
; x
++) {
40 uint32_t val
= (uint32_t) key
[x
];