For a quick solution without external libraries, you can use hash<std::string> for the string s hash. It is determined by the inclusion of hash_map or unordered_map (or some other) header files.
#include <string> #include <unordered_map> hash<string> hasher; string s = "heyho"; size_t hash = hasher(s);
If you decide that you want the added SHA security, you do not need to download the large Crypto ++ library unless you need all its other functions; There are many standalone implementations on the Internet, just search for "sha implementation C ++".
source share