Hanstable is a simple hash table implementation in C. It accepts a const char* as the key and a void* as the content. The initial size can be set and will resize automatically at certain loads (shrink at 33%, grow at 67%).


The library uses three forms of parameter sanitation: hard, soft and unchecked.

  • Hard - all checks are asserts, causing the program to stop on encountering an invalid argument and follow the standard assert procedure.
  • Soft - only an error code will be returned upon error. Nothing will crash (inside the library).
  • Unchecked - as the name says, it does not check at all. This is the fastest, but also the most dangerous, obviously.
It is recommended to use hard and swap it out with unchecked for release builds. Use soft sanitation in environments where not every access can be checked (such as in dlopenable modules).


There are prebuilt packages for Windows x86/x64 of Hanstable containing all variants as static libraries.
The source comes with a CMakeLists.txt if you want to build it yourself.

Documentation and examples