Last active
August 29, 2015 14:09
-
-
Save kirang89/52a7799f4c56cfd53977 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# | |
# String.hashCode in Python | |
# | |
def java_string_hashcode(s): | |
h=0 | |
for c in s: | |
h = (31 * h + ord(c)) & 0xFFFFFFFF | |
return (h + 0x80000000) & 0xFFFFFFFF - 0x80000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment