hash/sdbm.c

9 lines
178 B
C
Raw Normal View History

2024-06-28 22:37:51 +00:00
unsigned long sdbm(char *str) {
unsigned long hash = 0;
for (int c = *str; c != 0; c = *str++)
hash = c + (hash << 6) + (hash << 16) - hash;
return hash;
}