Skip to content

Instantly share code, notes, and snippets.

@zapthedingbat
Created August 6, 2014 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zapthedingbat/ee6de4fd713be4afd8ae to your computer and use it in GitHub Desktop.
Save zapthedingbat/ee6de4fd713be4afd8ae to your computer and use it in GitHub Desktop.
Basic hash code function
function hash(s){
return Array.prototype.reduce.call(s, function(a,b){ a = (( a << 5) -a ) + b.charCodeAt(0); return a&a }, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment