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

RCSID("$Id: cdb_hash.c,v 1.2 2000/02/29 19:31:33 shmit Exp $");

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;
}