caculateCRC static method

int caculateCRC(
  1. Uint8List bytes
)

caculate CRC by input bytes array

Implementation

static int caculateCRC(Uint8List bytes) {
  if (bytes.length <= 0) return 0;

  int tmp;
  int wordCRC = 0xFFFF;
  for (int i = 0; i < bytes.length; i++) {
    tmp = (bytes[i] ^ wordCRC) & 0xFF;
    wordCRC >>= 8;
    wordCRC ^= _crcTable[tmp];
  }

  return wordCRC;
}