15 lines
182 B
C
15 lines
182 B
C
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
uint64_t hash_string(const char *s)
|
||
|
|
{
|
||
|
|
uint64_t h = 0xcbf29ce484222325;
|
||
|
|
|
||
|
|
while (*s) {
|
||
|
|
h ^= *(unsigned char *)s;
|
||
|
|
h *= 0x100000001b3;
|
||
|
|
s++;
|
||
|
|
}
|
||
|
|
|
||
|
|
return h;
|
||
|
|
}
|