Search code examples
clinuxhashmd5gnu

Is there a glibc hash function?


I'm looking to do a custom hash table implementation in C. Is there an MD5/SHA1 hash function already in the GNU library or do I have to use an external library for this?

Here's kinda what I'm looking for:

int hashValue;

hashValue = MD5_HASH(valToHash);

Solution

  • You can take a look at Bob Jenkin's survey and analysis of many hash functions:

    Or just drop his lookup3 routines (which he's put into the public domain) into your project: