Created
January 22, 2015 06:24
-
-
Save thushan/e0afaf3f535d425ee3ed to your computer and use it in GitHub Desktop.
jhash hashing function implementation, see http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx
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
int jhash(string value) | |
{ | |
int h = 8388617; | |
char[] values = value.ToCharArray(); | |
for(int i = 0; i< value.Length; i++) | |
h = ( (h << 1 | h >> 30) & 0x7fffffff ) ^ values[i]; | |
return h; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, and easy to lend itself to a fold: