fastcrc

Read the Docs PyPI Python - Version

A hyper-fast Python module for computing CRC(8, 16, 32, 64) checksum.

Installation

pip install fastcrc

Usage

from fastcrc import crc8, crc16, crc32, crc64

data = b"123456789"
print(f"crc8 checksum with cdma2000 algorithm: {crc8.cdma2000(data)}")
print(f"crc16 checksum with xmodem algorithm: {crc16.xmodem(data)}")
print(f"crc32 checksum with aixm algorithm: {crc32.aixm(data)}")
print(f"crc64 checksum with ecma_182 algorithm: {crc64.ecma_182(data)}")
print(f"crc16 checksum with xmodem algorithm (with initial data): {crc16.xmodem(b'56789', crc16.xmodem(b'1234'))}")

Documentation

fastcrc’s documentation can be found at https://fastcrc.readthedocs.io

License

fastcrc is licensed under MIT License.

Thanks

fastcrc is made possible by crc-rs.

API Reference

CRC 8

Compute a CRC-16 checksum of data.

fastcrc.crc8.autosar(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the autosar algorithm.

Algorithm parameters:
  • poly: 0x2f

  • init: 0xff

  • xorout: 0xff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.bluetooth(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the bluetooth algorithm.

Algorithm parameters:
  • poly: 0xa7

  • init: 0x00

  • xorout: 0x00

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.cdma2000(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the cdma2000 algorithm.

Algorithm parameters:
  • poly: 0x9b

  • init: 0xff

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.darc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the darc algorithm.

Algorithm parameters:
  • poly: 0x39

  • init: 0x00

  • xorout: 0x00

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.dvb_s2(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the dvb_s2 algorithm.

Algorithm parameters:
  • poly: 0xd5

  • init: 0x00

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.gsm_a(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the gsm_a algorithm.

Algorithm parameters:
  • poly: 0x1d

  • init: 0x00

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.gsm_b(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the gsm_b algorithm.

Algorithm parameters:
  • poly: 0x49

  • init: 0x00

  • xorout: 0xff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.i_432_1(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the i_432_1 algorithm.

Algorithm parameters:
  • poly: 0x07

  • init: 0x00

  • xorout: 0x55

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.i_code(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the i_code algorithm.

Algorithm parameters:
  • poly: 0x1d

  • init: 0xfd

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.lte(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the lte algorithm.

Algorithm parameters:
  • poly: 0x9b

  • init: 0x00

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.maxim_dow(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the maxim_dow algorithm.

Algorithm parameters:
  • poly: 0x31

  • init: 0x00

  • xorout: 0x00

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.mifare_mad(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the mifare_mad algorithm.

Algorithm parameters:
  • poly: 0x1d

  • init: 0xc7

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.nrsc_5(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the nrsc_5 algorithm.

Algorithm parameters:
  • poly: 0x31

  • init: 0xff

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.opensafety(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the opensafety algorithm.

Algorithm parameters:
  • poly: 0x2f

  • init: 0x00

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.rohc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the rohc algorithm.

Algorithm parameters:
  • poly: 0x07

  • init: 0xff

  • xorout: 0x00

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.sae_j1850(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the sae_j1850 algorithm.

Algorithm parameters:
  • poly: 0x1d

  • init: 0xff

  • xorout: 0xff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.smbus(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the smbus algorithm.

Algorithm parameters:
  • poly: 0x07

  • init: 0x00

  • xorout: 0x00

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.tech_3250(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the tech_3250 algorithm.

Algorithm parameters:
  • poly: 0x1d

  • init: 0xff

  • xorout: 0x00

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc8.wcdma(data: bytes, initial: int | None = None) int[source]

Compute a CRC-8 checksum of data with the wcdma algorithm.

Algorithm parameters:
  • poly: 0x9b

  • init: 0x00

  • xorout: 0x00

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

CRC 16

Compute a CRC-16 checksum of data.

fastcrc.crc16.arc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the arc algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0x0000

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.cdma2000(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the cdma2000 algorithm.

Algorithm parameters:
  • ploy: 0xc867

  • init: 0xffff

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.cms(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the cms algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0xffff

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.dds_110(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the dds 110 algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0x800d

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.dect_r(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the dect r algorithm.

Algorithm parameters:
  • ploy: 0x0589

  • init: 0x0000

  • xorout: 0x0001

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.dect_x(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the dect x algorithm.

Algorithm parameters:
  • ploy: 0x0589

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.dnp(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the dnp algorithm.

Algorithm parameters:
  • ploy: 0x3d65

  • init: 0x0000

  • xorout: 0xffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.en_13757(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the en 13757 algorithm.

Algorithm parameters:
  • ploy: 0x3d65

  • init: 0x0000

  • xorout: 0xffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.genibus(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the genibus algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0xffff

  • xorout: 0xffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.gsm(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the gsm algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0x0000

  • xorout: 0xffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.ibm_3740(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the ibm 3740 algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0xffff

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.ibm_refin(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the ibm refin algorithm.

This method may be removed in the future.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0x0000

  • xorout: 0x0000

  • refin: True

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.ibm_sdlc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the ibm sdlc algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0xffff

  • xorout: 0xffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.iso_iec_14443_3_a(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the iso iec 14443 3 a algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0xc6c6

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.kermit(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the kermit algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0x0000

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.lj1200(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the lj1200 algorithm.

Algorithm parameters:
  • ploy: 0x6f63

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.maxim_dow(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the maxim dow algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0x0000

  • xorout: 0xffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.mcrf4xx(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the mcrf4xx algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0xffff

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.modbus(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the modbus algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0xffff

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.nrsc_5(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the nrsc 5 algorithm.

Algorithm parameters:
  • ploy: 0x080b

  • init: 0xffff

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.opensafety_a(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the opensafety a algorithm.

Algorithm parameters:
  • ploy: 0x5935

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.opensafety_b(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the opensafety b algorithm.

Algorithm parameters:
  • ploy: 0x755b

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.profibus(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the profibus algorithm.

Algorithm parameters:
  • ploy: 0x1dcf

  • init: 0xffff

  • xorout: 0xffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.riello(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the riello algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0xb2aa

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.spi_fujitsu(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the spi fujitsu algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0x1d0f

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.t10_dif(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the t10 dif algorithm.

Algorithm parameters:
  • ploy: 0x8bb7

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.teledisk(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the teledisk algorithm.

Algorithm parameters:
  • ploy: 0xa097

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.tms37157(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the tms37157 algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0x89ec

  • xorout: 0x0000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.umts(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the umts algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.usb(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the usb algorithm.

Algorithm parameters:
  • ploy: 0x8005

  • init: 0xffff

  • xorout: 0xffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc16.xmodem(data: bytes, initial: int | None = None) int[source]

Compute a CRC-16 checksum of data with the xmodem algorithm.

Algorithm parameters:
  • ploy: 0x1021

  • init: 0x0000

  • xorout: 0x0000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

CRC 32

Compute a CRC-32 checksum of data.

fastcrc.crc32.aixm(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the aixm algorithm.

Algorithm parameters:
  • ploy: 0x814141ab

  • init: 0x00000000

  • xorout: 0x00000000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.autosar(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the autosar algorithm.

Algorithm parameters:
  • ploy: 0xf4acfb13

  • init: 0xffffffff

  • xorout: 0xffffffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.base91_d(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the base91 d algorithm.

Algorithm parameters:
  • ploy: 0xa833982b

  • init: 0xffffffff

  • xorout: 0xffffffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.bzip2(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the bzip2 algorithm.

Algorithm parameters:
  • ploy: 0x04c11db7

  • init: 0xffffffff

  • xorout: 0xffffffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.cd_rom_edc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the cd rom edc algorithm.

Algorithm parameters:
  • ploy: 0x8001801b

  • init: 0x00000000

  • xorout: 0x00000000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.cksum(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the cksum algorithm.

Algorithm parameters:
  • ploy: 0x04c11db7

  • init: 0x00000000

  • xorout: 0xffffffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.iscsi(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the iscsi algorithm.

Algorithm parameters:
  • ploy: 0x1edc6f41

  • init: 0xffffffff

  • xorout: 0xffffffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.iso_hdlc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the iso hdlc algorithm.

Algorithm parameters:
  • ploy: 0x04c11db7

  • init: 0xffffffff

  • xorout: 0xffffffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.jamcrc(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the jamcrc algorithm.

Algorithm parameters:
  • ploy: 0x04c11db7

  • init: 0xffffffff

  • xorout: 0x00000000

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.k_reversed_reciprocal_refin(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the k reversed reciprocal refin algorithm.

This method may be removed in the future.

Algorithm parameters:
  • ploy: 0xba0dc66b

  • init: 0x00000000

  • xorout: 0x00000000

  • refin: True

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.mpeg_2(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the mpeg 2 algorithm.

Algorithm parameters:
  • ploy: 0x04c11db7

  • init: 0xffffffff

  • xorout: 0x00000000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc32.xfer(data: bytes, initial: int | None = None) int[source]

Compute a CRC-32 checksum of data with the xfer algorithm.

Algorithm parameters:
  • ploy: 0x000000af

  • init: 0x00000000

  • xorout: 0x00000000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

CRC 64

Compute a CRC-64 checksum of data.

fastcrc.crc64.ecma_182(data: bytes, initial: int | None = None) int[source]

Compute a CRC-64 checksum of data with the ecma 182 algorithm.

Algorithm parameters:
  • ploy: 0x42f0e1eba9ea3693

  • init: 0x0000000000000000

  • xorout: 0x0000000000000000

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc64.go_iso(data: bytes, initial: int | None = None) int[source]

Compute a CRC-64 checksum of data with the go iso algorithm.

Algorithm parameters:
  • ploy: 0x000000000000001b

  • init: 0xffffffffffffffff

  • xorout: 0xffffffffffffffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc64.we(data: bytes, initial: int | None = None) int[source]

Compute a CRC-64 checksum of data with the we algorithm.

Algorithm parameters:
  • ploy: 0x42f0e1eba9ea3693

  • init: 0xffffffffffffffff

  • xorout: 0xffffffffffffffff

  • refin: False

  • refout: False

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object

fastcrc.crc64.xz(data: bytes, initial: int | None = None) int[source]

Compute a CRC-64 checksum of data with the xz algorithm.

Algorithm parameters:
  • ploy: 0x42f0e1eba9ea3693

  • init: 0xffffffffffffffff

  • xorout: 0xffffffffffffffff

  • refin: True

  • refout: True

Parameters:
  • data (bytes) – The data to be computed

  • initial (Optional[int]) – The optional starting value of the checksum

Returns:

The checksum

Return type:

int

Raises:

TypeError – if the data is not a bytes-like object