summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorCarson Fleming <[email protected]>2026-02-14 02:53:37 -0500
committerCarson Fleming <[email protected]>2026-02-14 02:53:37 -0500
commit9ef0abf7ab5266f6b58c0e55bbe9dd9038bc7f6e (patch)
tree54abfa548d7aae56c1ace1a72bce8581570b5fd2 /hash.c
parent1a08245d480b8a18fcbc80efd8602cdb90d6ed5e (diff)
downloadsafec-9ef0abf7ab5266f6b58c0e55bbe9dd9038bc7f6e.tar.gz
more like dangerousc.org atp
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;
+}