Esempio n. 1
0
        public void Hash(IEnumerable <byte> source, byte[] expectedHash)
        {
            var hasher = new Crc32c();

            byte[] actualHash = hasher.ComputeHash(source.ToArray());
            Assert.Equal(expectedHash, actualHash);
        }
Esempio n. 2
0
        public void TestCrc32c()
        {
            var crc32c = new Crc32c();
            var bytes  = Encoding.UTF8.GetBytes("123456789");

            var hash = crc32c.ComputeHash(bytes);
            var crc  = BitConverter.ToUInt32(hash);

            Assert.AreEqual(crc, 0xe3069283);
        }