]> www.average.org Git - psmb.git/blob - src/hash64.c
wip send/recv
[psmb.git] / src / 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 }