Files
libucore/src/djbhash.c
T
2013-03-06 22:22:04 +01:00

14 lines
190 B
C

#include "ucore/hash.h"
uint32_t
uc_djbhash(const char *str)
{
uint32_t hash = 5381;
int c;
while ((c = *str++))
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}