1 2 3 4 5 6 7 8 9 10
#include "sdbm.h" unsigned long sdbm(char *str) { unsigned long hash = 0; int c; while(c = *str++) { hash = c + (hash << 6) + (hash << 16) - hash; } return hash; }