CRC implementation with configurable polynomials.
A pure TypeScript CRC library supporting CRC8, CRC16, CRC32, and CRC64.
Each width is exposed at three layers:
- One-shot:
crc8/crc16/crc32/crc64— convenience helpers that use a conventional default polynomial. - Factory:
createCrc8/ etc. — return a reusable function bound to a specific polynomial (each call builds the lookup table). - Memoized factory:
memoizedCreateCrc8/ etc. — same as the factory, but repeated calls with the same polynomial reuse the cached function.
Calculates CRC16 checksum for the given data.
Calculates CRC32 checksum for the given data.
Calculates CRC64 checksum for the given data.
Calculates CRC8 checksum for the given data.
Creates a CRC16 function for the given polynomial.
Creates a CRC32 function for the given polynomial.
Creates a CRC64 function for the given polynomial.
Creates a CRC8 function for the given polynomial.
Memoized version of createCrc16.
Memoized version of createCrc32.
Memoized version of createCrc64.
Memoized version of createCrc8.
CRC16-CCITT polynomial (X.25, HDLC, Bluetooth).
CRC16-IBM/ANSI polynomial (USB, Modbus).
Standard CRC32 polynomial (ISO 3309, PNG, ZIP, gzip).
CRC32C polynomial (iSCSI, SCTP, ext4). Also known as Castagnoli.
CRC32K polynomial (Koopman). Designed for improved Hamming-distance coverage.
CRC64-ECMA polynomial (XZ, 7z).
CRC64-ISO polynomial (ISO 3309).
CRC8-CCITT polynomial (ATM HEC).
CRC8-Maxim/Dallas polynomial (1-Wire, iButton).
Usage
import * as mod from "mod.ts";