public ushort ComputeChecksum(byte[] bytes)
{
ushort crc = 0;
for (int i = 0; i < bytes.Length; ++i)
{
//byte index = (byte)(crc ^ bytes[i]);
//crc = (ushort)((crc >> 8) ^ CrcTable[index]);
crc = (ushort)(CrcTable[(bytes[i] ^ crc) & 0xFF] ^ (crc >> 8));
// crc = (ushort)((crc << 8) ^ CrcTable[((crc >> 8) ^ (0xff & bytes[i]))]);
}
return crc;
}