summaryrefslogtreecommitdiff
path: root/src/hash.h
blob: f9da7bb6b1b8be14f4c89a58c66887e67105b781 (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(const 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