Ejemplo n.º 1
0
        public void Crc8_Maxim()
        {
            string expected  = "80";
            Crc8   actualCrc = Crc8.GetMaxim();

            actualCrc.Append("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", true);
            string actual = actualCrc.Digest.ToString("X2");

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
 public void TestCrc8(string name, byte polynomial, byte initialState, byte xorOutput, bool reverseInput, bool reverseOutput, byte check)
 {
     using (Crc8 crc = new Crc8(polynomial, initialState, xorOutput, reverseInput, reverseOutput))
     {
         crc.Initialize();
         var bytes = Encoding.UTF8.GetBytes(data);
         for (int i = 0; i < bytes.Length; i++)
         {
             crc.Append(bytes[i]);
         }
         byte output = crc.CurrentOutput;
         Assert.AreEqual(check, output, 0);
     }
 }