Skip to content

Instantly share code, notes, and snippets.

@jneill
Created October 11, 2013 17:11
Show Gist options
  • Save jneill/6938471 to your computer and use it in GitHub Desktop.
Save jneill/6938471 to your computer and use it in GitHub Desktop.
String#hashCode()
String::hashCode = ->
res = 0
for i in [0...@length]
res = (31 * res + @charCodeAt(i)) << 0
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment