getCrc32 function

int getCrc32(
  1. ByteBuffer buf
)

Calculate the CRC32 of a blob.

Implementation

int getCrc32(ByteBuffer buf) {
  final b = buf.asUint8List();
  int crc = -1;
  for (int i = 0; i < b.length; i++) {
    final byte = b[i];
    final t = (byte ^ crc) & 0xff;
    crc = _lookUpTable[t] ^ ((crc & 0xffffffff) >> 8);
  }
  return ((crc ^ -1) & 0xffffffff) >> 0;
}