20 lines
222 B
C
20 lines
222 B
C
#include "ucore_hash.h"
|
|
|
|
uint32_t
|
|
uc_pjwhash(const char *str,size_t len)
|
|
{
|
|
|
|
unsigned h = 0, g;
|
|
|
|
while (len--) {
|
|
h = (h << 4) + *str++;
|
|
if ((g = h & 0xf0000000)) {
|
|
h ^= (g >> 24);
|
|
h ^= g;
|
|
}
|
|
}
|
|
|
|
return h;
|
|
}
|
|
|