summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hash.c b/hash.c
new file mode 100644
index 0000000..6201275
--- /dev/null
+++ b/hash.c
@@ -0,0 +1,10 @@
+#include "hash.h"
+
+size_t hash_bytes(const void* start, size_t size) {
+ size_t hash = 0;
+ const char* raw_data = start;
+ for (size_t i = 0; i < size; i++) {
+ hash = (hash << 5) - hash + raw_data[i];
+ }
+ return hash;
+}