1// Djb2 hash function - really good and implementable code
2unsigned long hash(char *str) {
3
4 unsigned long hash = 5381;
5 int c;
6 while ((c = *str++))
7 hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
8 return hash % NUM_BUCKETS;
9
10}