Source
return ZBX_DEFAULT_STRING_HASH_ALGO(data, strlen((const char *)data), ZBX_DEFAULT_HASH_SEED);
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
typedef unsigned char uchar;
/*
* modified FNV hash function (see http://www.isthe.com/chongo/tech/comp/fnv/)
*/
zbx_hash_t zbx_hash_modfnv(const void *data, size_t len, zbx_hash_t seed)
{
const uchar *p = (const uchar *)data;
zbx_hash_t hash;
hash = 2166136261u ^ seed;
while (len-- >= 1)
{
hash = (hash ^ *(p++)) * 16777619u;
}
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
return hash;
}
/*
* see http://xoshiro.di.unimi.it/splitmix64.c
*/
zbx_hash_t zbx_hash_splittable64(const void *data)
{
zbx_uint64_t value = *(const zbx_uint64_t *)data;
value ^= value >> 30;
value *= __UINT64_C(0xbf58476d1ce4e5b9);
value ^= value >> 27;
value *= __UINT64_C(0x94d049bb133111eb);