summaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash.h')
-rw-r--r--src/hash.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/hash.h b/src/hash.h
new file mode 100644
index 0000000..238b15b
--- /dev/null
+++ b/src/hash.h
@@ -0,0 +1,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