crclib library

Generic CRC calculations as Dart converters and some common algorithms.

The easiest way to use this library is to call convert on the instance of the desired CRC routine.

Crc32Xz().convert(utf8.encode('123456789')) == 0xCBF43926

Another supported use case is as stream transformers.

File(...).openRead().transform(Crc32Xz())

Instead of using predefined classes, it is also possible to construct a customized CRC function with ParametricCrc class. For a list of known CRC routines, check out http://reveng.sourceforge.net/crc-catalogue/all.htm.

TODO:

  1. inputReflected and outputReflected can be different, see CRC-12/UMTS.
  2. Bit-level checksums (including non-multiple-of-8 checksums).

Classes

CrcFlipper
Utility class to find bit positions to flip to yield a desired CRC value.
CrcValue
Represents a CRC value. Objects of this class should only be tested for equality against int or BigInt, printed with toString or toRadixString, or up-valued toBigInt.
MultiCrc
A dummy CRC function that concatenates a list of others. Other than lengthInBits, other CRC parameters are not used and should not be trusted.
ParametricCrc
The table lookup implementation of all CRC routines. The parameters are: