crc32 function

int crc32(
  1. String data
)

Computes the CRC32 checksum of data encoded as UTF-8.

Returns an unsigned 32-bit integer.

Implementation

int crc32(String data) {
  final bytes = utf8.encode(data);
  int crc = 0xFFFFFFFF;

  for (final byte in bytes) {
    crc = (crc >>> 8) ^ _crc32Table[(crc ^ byte) & 0xFF];
  }

  return (crc ^ 0xFFFFFFFF) & 0xFFFFFFFF;
}