17 lines
246 B
C
17 lines
246 B
C
#include <stdint.h>
|
|
|
|
#define BASIS 0xcbf29ce484222325
|
|
#define PRIME 0x100000001b3
|
|
|
|
uint64_t hash_string(const char *s)
|
|
{
|
|
uint64_t result = BASIS;
|
|
|
|
for (unsigned int i = 0; s[i]; i++) {
|
|
result ^= s[i];
|
|
result *= PRIME;
|
|
}
|
|
|
|
return result;
|
|
}
|