summaryrefslogtreecommitdiffstats
path: root/server/cdb_hash.c
blob: 500466137537201f6cf476ad74aa157809f5d45d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "conf.h"
#include "cdbpriv.h"

uint32_t
cdb_hash(const unsigned char *buf, unsigned int len)
{
	uint32_t h;

	h = 5381;
	while (len) {
		--len;
		h += (h << 5);
		h ^= (uint32_t)*buf++;
	}
	return h;
}