예제 #1
0
        public void HashCoreTest()
        {
            FNV1a64_Accessor target = new FNV1a64_Accessor(); // TODO: Initialize to an appropriate value

            byte[] array   = ASCIIEncoding.ASCII.GetBytes("chongo was here!\n");
            int    ibStart = 0;
            int    cbSize  = array.Length;

            target.HashCore(array, ibStart, cbSize);
            Assert.AreEqual((UInt64)0x46810940eff5f915, target.FNVHash);
        }
예제 #2
0
        public void HashFinalTest()
        {
            FNV1a64_Accessor target = new FNV1a64_Accessor(); // TODO: Initialize to an appropriate value

            byte[] array   = ASCIIEncoding.ASCII.GetBytes("chongo was here!\n");
            int    ibStart = 0;
            int    cbSize  = array.Length;

            target.HashCore(array, ibStart, cbSize);
            byte[] expected = { 0x15, 0xf9, 0xf5, 0xef, 0x40, 0x09, 0x81, 0x46 }; // 0x46810940eff5f915ULL
            byte[] actual;
            actual = target.HashFinal();
            Assert.AreEqual(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }