clash is a generic closed hashmap that looks and behaves like a list of nullable pointers.
Find a file
2026-06-06 17:00:10 +09:30
.clang-format Add source 2026-05-13 00:34:52 +09:30
clash.h Add header guards back in 2026-06-06 17:00:10 +09:30
LICENSE Add license 2026-06-05 05:38:28 +09:30
README.md Improve docs 2026-05-13 00:52:42 +09:30
test.c Fix shuffling edge case and copy comments to implementation 2026-05-14 10:05:43 +09:30

clash

because I was bored. this time it's about ~200 LOC implementing a dynamic closed hashmap in C.

you can ignore the bottom half of the lines in clash.h, it's a SipHash implementation I copied from somewhere.

examples

// create a new map of ints
clash map = clash_new(sizeof(int));

// add a new value to the map
map = clash_set(map, "coolguy1234", &(int){4});

// doesn't actually do anything, since that key doesn't exist
clash_delete(map, "'; DROP DATABASE prod;");

// gets the previously assigned value, or NULL
int val = *(int*)clash_get(map, "coolguy1234");

//      4
printf("%d\n", val);