Пример #1
0
        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);
        }
Пример #2
0
 public uint DJBHash32Test()
 {
     return(DJBHash32.ComputeHash(_testData));
 }