public void CheckReferenceResults() { //DJBHash32 uint r1 = DJBHash32.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt32(_testResults[typeof(DJBHash32)], 0), r1); //Farmhash32 uint r2 = FarmHash32.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt32(_testResults[typeof(FarmHash32)], 0), r2); //Farmhash64 ulong r3 = FarmHash64.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt64(_testResults[typeof(FarmHash64)], 0), r3); //FNV1A32 uint r4 = FNV1A32.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt32(_testResults[typeof(FNV1A32)], 0), r4); //MurmurHash32 uint r5 = MurmurHash32.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt32(_testResults[typeof(MurmurHash32)], 0), r5); //MurmurHash128 byte[] r6 = MurmurHash128.ComputeHash(_testData); Assert.True(_testResults[typeof(MurmurHash128)].SequenceEqual(r6)); //SipHash64 ulong r7 = SipHash64.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt64(_testResults[typeof(SipHash64)], 0), r7); //SuperFastHash32 uint r8 = SuperFastHash32.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt32(_testResults[typeof(SuperFastHash32)], 0), r8); //xxHash32 uint r9 = xxHash32.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt32(_testResults[typeof(xxHash32)], 0), r9); //xxHash64 ulong r10 = xxHash64.ComputeHash(_testData); Assert.Equal(BitConverter.ToUInt64(_testResults[typeof(xxHash64)], 0), r10); }
public void TestVectors() { for (int i = 0; i < MaxLength; ++i) { byte[] data = new byte[i]; for (int j = 0; j < i; j++) { data[j] = (byte)j; } ulong k0, k1; Utilities.ToULongs(_key, out k0, out k1); ulong result = SipHash64.ComputeHash(data, k0, k1); ulong expected = BitConverter.ToUInt64(_vectors[i], 0); Assert.Equal(expected, result); } }
public ulong SipHash64Test() { return(SipHash64.ComputeHash(_testData)); }