I was looking to convert some old code I found to a .net standard compliant version. However I haven't used code like this before so I'm a bit lost on how to use it as it doesn't compile.
I understand that uint cannot be negative but how did this code work in the past?
public static uint Hash(string str, HashType hashType)
{
unsafe
{
uint cryptTable = 2146271213;
uint num = -286331154;
string upperInvariant = str.ToUpperInvariant();
for (int i = 0; i < upperInvariant.get_Length(); i++)
{
uint num1 = (byte)upperInvariant[i];
cryptTable = Crypto.CryptTable[&((uint)hashType * 256 + num1)] ^ cryptTable + num;
num = num1 + cryptTable + num + (num << 5) + 3;
}
return cryptTable;
}
}
public enum HashType : uint
{
FileHashTableIndex,
FilePathA,
FilePathB,
TableKey
}