Пример #1
0
        public void TestMask()
        {
            var crc = new Crc32C();

            crc.Update(Encoding.ASCII.GetBytes("foo"), 0, 3);

            Assert.Equal(crc.GetMaskedValue(), Mask(crc.GetIntValue()));
            Assert.False(crc.GetIntValue() == crc.GetMaskedValue(), "crc should not match masked crc");
            Assert.False(crc.GetIntValue() == Mask(crc.GetMaskedValue()), "crc should not match double masked crc");
            Assert.Equal(crc.GetIntValue(), Unmask(crc.GetMaskedValue()));
            Assert.Equal(crc.GetIntValue(), Unmask(Unmask(Mask(crc.GetMaskedValue()))));
        }