summaryrefslogtreecommitdiff
path: root/cdb_hash.c
blob: 823802091f15e028de9c5e49c61819da3451e0be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "cdb.h"

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

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