]> www.average.org Git - psmb.git/blob - hash64.c
fef4aa85526cc15670fcf3b2b9fafe0bccec4d37
[psmb.git] / hash64.c
1 /* Lifted from https://stackoverflow.com/a/13326345/2786866 */
2
3 #include "hash64.h"
4
5 uint64_t hash64(void *data, size_t size)
6 {
7         uint64_t mix = 0, mulp = 2654435789;
8         for (int i = 0; i < size; i++)
9                 mix += (((uint8_t *)data)[i] * mulp) ^ (mix >> 23);
10         return mix ^ (mix << 37);
11 }