summaryrefslogtreecommitdiff
path: root/src/hash.h
blob: 238b15b5af9bf3b6cfe4b4ea85c0dbc7f822389f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef HASH_H
#define HASH_H

#include <stdint.h>

static uint64_t fnv(uint8_t *data, size_t size) {
	uint64_t hash = 0xcbf29ce484222325;
	for (size_t i = 0; i < size; i++) {
		hash ^= data[i];
		hash *= 0x100000001b3;
	}
	return hash;
}

#endif