STL Hash Functions

to summarize:

  • The STL has hash functions
  • The C++98 standard library does not
  • The C++ TR1 has hash functions (6.3.3[tr.unord.hash])
  • boost has hash functions
  • The C++11 standard library has hash functions (20.8.12[unord.hash])

And all of them are designed for hashed associative containers, not for cryptography.


I guess you're looking for hash functions for hash tables, not for cryptography, correct?

In that case, what about boost::hash?

The documentation says it's compatible with the TR1 hash, which should become part of the upcoming C++0x standard. That means it's probably already found in quite a few compilers.

For cryptographic hashes, there seems to be a SHA-1 implementation in Boost, but the way to go if you need them heavyweight is to use a dedicated library, such as Crypto++.