16 lines
281 B
C#
16 lines
281 B
C#
|
|
internal static class HashUtil
|
||
|
|
{
|
||
|
|
public static uint Hash(string str)
|
||
|
|
{
|
||
|
|
const uint prime = 0x1000193;
|
||
|
|
var hash = 0x811c9dc5;
|
||
|
|
|
||
|
|
foreach (var ch in str)
|
||
|
|
{
|
||
|
|
hash ^= ch;
|
||
|
|
hash *= prime;
|
||
|
|
}
|
||
|
|
|
||
|
|
return hash;
|
||
|
|
}
|
||
|
|
}
|