public void Arc_2() { var crc = Crc16.GetArc(); crc.ComputeHash(Encoding.ASCII.GetBytes("123456789")); Assert.Equal(0xBB3D, (ushort)crc.HashAsInt16); }
public void Arc() { string expected = "0x178C"; var crc = Crc16.GetArc(); crc.ComputeHash(Encoding.ASCII.GetBytes("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")); Assert.Equal(expected, $"0x{crc.HashAsInt16:X4}"); Assert.Equal(expected, "0x" + BitConverter.ToString(crc.Hash).Replace("-", "")); }
public void Crc16_Arc() { string expected = "178C"; Crc16 actualCrc = Crc16.GetArc(); actualCrc.Append("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", true); string actual = actualCrc.Digest.ToString("X4"); Assert.AreEqual(expected, actual); }