private ulong CalculateHash() { if (string.IsNullOrEmpty(_value)) { return(0); } var buffer = Encoding.UTF8.GetBytes(_value); var sBuffer = Array.ConvertAll(buffer, b => b != 0x80 ? (byte)Math.Abs((sbyte)b) : (byte)0x80); return(FNV1A64HashAlgorithm.HashReadOnlySpan(sBuffer)); }
public void TestFNV1a64_ByteSpan(byte[] test, ulong result) { Assert.AreEqual(FNV1A64HashAlgorithm.HashReadOnlySpan(test), result); }
public void TestFNV1a64_CharSpan(string test, ulong result) { Assert.AreEqual(FNV1A64HashAlgorithm.HashReadOnlySpan(test.AsSpan()), result); }