Skip to main content

Calculation library for CRCs and checksums

Project description

The crccheck.crc module implements all CRCs listed in the Catalogue of parametrised CRC algorithms:

CRC-3/ROHC, CRC-4/ITU, CRC-5/EPC, CRC-5/ITU, CRC-5/USB, CRC-6/CDMA2000-A, CRC-6/CDMA2000-B, CRC-6/DARC, CRC-6/ITU, CRC-7, CRC-7/ROHC, CRC-8, CRC-8/CDMA2000, CRC-8/DARC, CRC-8/DVB-S2, CRC-8/EBU, CRC-8/I-CODE, CRC-8/ITU, CRC-8/MAXIM, CRC-8/ROHC, CRC-8/WCDMA, CRC-10, CRC-10/CDMA2000, CRC-11, CRC-12/3GPP, CRC-12/CDMA2000, CRC-12/DECT, CRC-13/BBC, CRC-14/DARC, CRC-15, CRC-15/MPT1327, CRC-16, ARC, CRC-16/AUG-CCITT, CRC-16/BUYPASS, CRC-16/CCITT-FALSE, CRC-16/CDMA2000, CRC-16/DDS-110, CRC-16/DECT-R, CRC-16/DECT-X, CRC-16/DNP, CRC-16/EN-13757, CRC-16/GENIBUS, CRC-16/MAXIM, CRC-16/MCRF4XX, CRC-16/RIELLO, CRC-16/T10-DIF, CRC-16/TELEDISK, CRC-16/TMS37157, CRC-16/USB, CRC-A, CRC-16 CCITT, KERMIT, MODBUS, X-25, XMODEM, CRC-24, CRC-24/FLEXRAY-A, CRC-24/FLEXRAY-B, CRC-31/PHILIPS, CRC-32, CRC-32/BZIP2, CRC-32C, CRC-32D, CRC-32/MPEG-2, CRC-32/POSIX, CRC-32Q, JAMCRC, XFER, CRC-40/GSM, CRC-64, CRC-64/WE, CRC-64/XZ, CRC-82/DARC.

For the class names simply remove all dashes and slashes from the above names and apply CamelCase, e.g. “CRC-32/MPEG-2” is implemented by Crc32Mpeg2. Other CRC can be calculated by using the general class crccheck.crc.Crc by providing all required CRC parameters.

The crccheck.checksum module implements additive and XOR checksums with 8, 16 and 32 bit: Checksum8, Checksum16, Checksum32 and ChecksumXor8, ChecksumXor16, ChecksumXor32

Usage example:

from crccheck.crc import Crc32, CrcXmodem
from crccheck.checksum import Checksum32

# Quick calculation
data = bytearray.fromhex("DEADBEEF")
crc = Crc32.calc(data)
checksum = Checksum32.calc(data)

# Procsss multiple data buffers
data1 = b"Binary string"  # or use .encode(..) on normal sring - Python 3 only
data2 = bytes.fromhex("1234567890")  # Python 3 only, use bytearray for older versions
data3 = (0x0, 255, 12, 99)  # Iterable which returns ints in byte range (0..255)
crcinst = CrcXmodem()
crcinst.process(data1)
crcinst.process(data2)
crcinst.process(data3[1:-1])
crcbytes = crcinst.finalbytes()
crchex = crcinst.finalhex()
crcint = crcinst.final()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crccheck-0.6.zip (20.6 kB view details)

Uploaded Source

Built Distributions

crccheck-0.6-py3.5.egg (39.8 kB view details)

Uploaded Source

crccheck-0.6-py3.4.egg (39.8 kB view details)

Uploaded Source

crccheck-0.6-py3.3.egg (39.4 kB view details)

Uploaded Source

crccheck-0.6-py2.7.egg (37.5 kB view details)

Uploaded Source

File details

Details for the file crccheck-0.6.zip.

File metadata

  • Download URL: crccheck-0.6.zip
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crccheck-0.6.zip
Algorithm Hash digest
SHA256 5686a4e5c3a2949597316c067c49c21e06051d13de9521434480cfa24dad7e32
MD5 d57224ee7285217d8dc2767c16f51bfe
BLAKE2b-256 2f4391b22ee387b9323eb0be0c6cbf266e010c69e5a98db45aa3bf30c9f2388d

See more details on using hashes here.

File details

Details for the file crccheck-0.6-py3.5.egg.

File metadata

  • Download URL: crccheck-0.6-py3.5.egg
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crccheck-0.6-py3.5.egg
Algorithm Hash digest
SHA256 363f72c48ae7669cdefe107d890bc66bab1a37529e0b0c7cedea35bc9c00a6ee
MD5 ab611f91e7742f5f7db6b2dce20455d6
BLAKE2b-256 c34de98104d04fb704ee0c4b121ba82ff34449684ba189dc7b4af9baedf28b4a

See more details on using hashes here.

File details

Details for the file crccheck-0.6-py3.4.egg.

File metadata

  • Download URL: crccheck-0.6-py3.4.egg
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crccheck-0.6-py3.4.egg
Algorithm Hash digest
SHA256 05ea576d8237f12e306a05dd272f94d2b38dae13120627b420458ddb0f7f7078
MD5 9f5bc87d36c052cafdeb4ab328712208
BLAKE2b-256 b251e03503c89b3d60966ff36577c2050ec61aa74dd546ceba421d2438260ee7

See more details on using hashes here.

File details

Details for the file crccheck-0.6-py3.3.egg.

File metadata

  • Download URL: crccheck-0.6-py3.3.egg
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crccheck-0.6-py3.3.egg
Algorithm Hash digest
SHA256 25226f7070d8ea6e6305e37261f7171a6da5c6daec70b3fa3af455b7a12d6374
MD5 521a715c61f77dfe741031175743b648
BLAKE2b-256 727c23baa6f61788fb2734060fe9614ea5a916d09236ca6114441b126e32cd22

See more details on using hashes here.

File details

Details for the file crccheck-0.6-py2.7.egg.

File metadata

  • Download URL: crccheck-0.6-py2.7.egg
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crccheck-0.6-py2.7.egg
Algorithm Hash digest
SHA256 02c24e5fb983f0e56165b6c6bb347e3e343011607a4d1e09e7451790b8dbd7e6
MD5 b7d8df756c066cf28bafb0381cc40544
BLAKE2b-256 fa7d0d5f01825499a3884d75d697c11b1f53aef93941da7d524cecbfeb16a8bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page