It depends on which version of C ++ you have ... and which hash function you are looking for.
In C ++ 03, there is no hash container, and therefore there is no need for hashing. However, many compilers offered custom headers. Otherwise, Boost.Functional.Hash can help.
C ++ 0x has a family of unordered_ containers and thus the predicate std::hash , which already works for standard C ++ types (at least the built-in types and std::string ).
However, this is a simple hash, good enough for hash cards, not for security .
If you are looking for a cryptographic hash, then the problem is completely different (and md5 is unstable), and you will need a library for (for example) the SHA-2 hash.
If you're looking for speed, check out CityHash and MurmurHash . Both have limitations, but they are highly optimized.
Matthieu M.
source share