Skip to content

Instantly share code, notes, and snippets.

@mkv27
Forked from eplawless/djb2.js
Created October 27, 2018 02:55
Show Gist options
  • Save mkv27/896700f18588b213dd8b49cd7b1262d3 to your computer and use it in GitHub Desktop.
Save mkv27/896700f18588b213dd8b49cd7b1262d3 to your computer and use it in GitHub Desktop.
function hash(str) {
var len = str.length;
var hash = 5381;
for (var idx = 0; idx < len; ++idx) {
hash = 33 * hash + str.charCodeAt(idx);
}
return hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment