Bob Adolf, Brian Cornell, and Geet Duggal. Date posted: 6/28/05. Last updated: 3/10/07.
The libhash
@ sourceforge page is undergoing some revisions
in hopes that it becomes more of central resource for (1) deciding when
a hash-based data structure should be used and then to (2) help make
appropriate decisions as to which source code to use. Please be patient
as more details are added.
For now please take a look at some hash table implementations by the authors on this sourceforge site. (All source code is in C.)
libhash
itself is the original library for chained hash
table with void* pointers for the types of the keys, values, and
functions. It supports rehashing, provides a couple of convenience
functions, and is easily placed into simple projects where fixed memory
is less of a concern. libhash-l_u
is a lowercase-underscore
and stripped-down version of the original libhash.
libhash-bob
is a library one would use/extend if they are more
concerned with fixed memory use and more advanced hash table methods.
All options are set with macros ahead of time so there are no void*s that
get compiled. This allows for more optimization by the complier, if you
would like. It is still in its early stages, but in its current state it
works. It supports chained, linear, and LICH coalesced hashes
(without deletion for now).
There are a variety of alternatives on the web that I've gone through and tested against personal hash libraries, and in time, the best of them will be surveyed on this site.
I often use fixed-memory (no dynamic allocation) linear probing hash table code that I wrote in C that allows you to specifiy byte lengths for the keys and values. When I get the chance, I'll post it here as an option, also.