Skip to content

Instantly share code, notes, and snippets.

@RevenantX
Last active May 16, 2016 16:47
Show Gist options
  • Save RevenantX/9817785b5a0741f124bc2a12ede85f9d to your computer and use it in GitHub Desktop.
Save RevenantX/9817785b5a0741f124bc2a12ede85f9d to your computer and use it in GitHub Desktop.
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