Ejemplo 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);
        }
Ejemplo n.º 2
0
        public void Hash(IEnumerable <byte> source, byte[] expectedHash)
        {
            var hasher = new Crc32c();

            hasher.UpdateHash(source.ToArray(), 0, source.Count());
            byte[] actualHash = hasher.GetHash();
            Assert.Equal(expectedHash, actualHash);
        }
Ejemplo n.º 3
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);
        }