Skip to content

Instantly share code, notes, and snippets.

@WebReflection
Created September 22, 2017 15:55
Show Gist options
  • Select an option

  • Save WebReflection/14d135b9a2b988ea8073d1098b0abd0f to your computer and use it in GitHub Desktop.

Select an option

Save WebReflection/14d135b9a2b988ea8073d1098b0abd0f to your computer and use it in GitHub Desktop.
function hash(str) {
var hval = 0x811c9dc5, i = 0, length = str.length;
while (i < length) {
hval ^= str.charCodeAt(i++);
hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);
}
return hval >>> 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment