Example #1
0
 //public static string CalcCRC16(string strInput)
 public static uint CalcCRC16(byte[] data)
 {
     var crc16Kermit = new Crc16(Crc16Mode.CcittKermit);
     var checksumtwoBytes = crc16Kermit.ComputeChecksumBytes(data);
     var checksumfourBytes = new byte[4];
     checksumfourBytes[0] = 0;
     checksumfourBytes[1] = 1;
     checksumfourBytes[2] = checksumtwoBytes[0];
     checksumfourBytes[3] = checksumtwoBytes[1];
     return BitConverter.ToUInt32(checksumfourBytes, 0);//.ToString("X4");
 }
Example #2
0
 //public static string CalcCRC16(string strInput)
 public static byte[] CalcCRC16InBytes(byte[] data)
 {
     var crc16Kermit = new Crc16(Crc16Mode.CcittKermit);
     var checksum = crc16Kermit.ComputeChecksumBytes(data);
     return checksum;
     //return BitConverter.ToUInt32(checksum, 0);//.ToString("X4");
 }