Created
August 6, 2014 15:31
-
-
Save zapthedingbat/ee6de4fd713be4afd8ae to your computer and use it in GitHub Desktop.
Basic hash code function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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