Skip to content

Instantly share code, notes, and snippets.

@dbrockman
Last active December 15, 2015 21:39
Show Gist options
  • Select an option

  • Save dbrockman/5327463 to your computer and use it in GitHub Desktop.

Select an option

Save dbrockman/5327463 to your computer and use it in GitHub Desktop.
Jenkins hash function on strings
function jenkins_hash(s) {
var hash = 0, i = 0, l = s.length;
for (; i < l; ++i) {
hash += s.charCodeAt(i);
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);
return hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment