Skip to content

Instantly share code, notes, and snippets.

@cthornton
Created October 25, 2018 22:37
Show Gist options
  • Save cthornton/79ec60bbe63fc4f5498b8c9222f4a282 to your computer and use it in GitHub Desktop.
Save cthornton/79ec60bbe63fc4f5498b8c9222f4a282 to your computer and use it in GitHub Desktop.
Hash function in c++
// Example:
//
// cout << hashString("hello world") << endl; // prints: 1128946856
#include <boost/functional/hash.hpp>
int hashString(const string& input) {
boost::hash<string> string_hash;
return string_hash(input);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment