Last active
May 16, 2016 16:47
-
-
Save RevenantX/9817785b5a0741f124bc2a12ede85f9d 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
public static class ArhiFastHasher | |
{ | |
private static char[] Buffer = new char[1024]; | |
public static ulong HashStr(string str) | |
{ | |
str.CopyTo(0, Buffer, 0, str.Length); | |
ulong hash = 14695981039346656037UL; //offset | |
for (var i = 0; i < str.Length; i++) | |
{ | |
hash = hash ^ Buffer[i]; | |
hash *= 1099511628211UL; //prime | |
} | |
return hash; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment