1 /* $Id: cdb_hash.c,v 1.5 2003/11/03 16:42:41 mjt Exp $
4 * This file is a part of tinycdb package by Michael Tokarev, mjt@corpit.ru.
13 cdb_hash(const void *buf
, unsigned len
)
15 const unsigned char *p
= static_cast<const unsigned char *>(buf
);
16 const unsigned char *end
= p
+ len
;
17 unsigned hash
= 5381; /* start value */
19 hash
= (hash
+ (hash
<< 5)) ^ *p
++;