Пример #1
0
        public void HashCoreTest()
        {
            FNV1a32_Accessor target = new FNV1a32_Accessor();

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

            target.HashCore(array, ibStart, cbSize);
            Assert.AreEqual((UInt32)0xd49930d5, target.FNVHash);
        }
Пример #2
0
        public void HashFinalTest()
        {
            FNV1a32_Accessor target = new FNV1a32_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 = { 0xd5, 0x30, 0x99, 0xd4 }; // 0xd49930d5UL
            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]);
            }
        }