Skip to main content

Library for calculating CRC16

Project description

CRC is a way of detecting accidental changes in data storage or transmission. There are many variants of CRC and CRC16, in particular. This library calculates only CRC16 (16-bit codes) and the only supported variant at the moment is CRC-CCITT (XModem).

If you want to know more about CRC, http://wikipedia.org/wiki/Cyclic_redundancy_check is a good place to start.

If you want other variants of CRC16 supported, please make a request at http://code.google.com/p/pycrc16/issues

Source codes are hosted at https://github.com/gennady/pycrc16 If you want to contribute to this library, create a fork, make you changes and then create a pull request. Any help is appreciated.

Installation

On Windows you can use precompiled binaries which can be found at http://code.google.com/p/pycrc16/downloads

On Linux and other operation systems you should compile the library from the source codes. To do this on Linux use following steps:

  • download source tarball, e.g. crc16-0.1.0.tar.gz, from http://code.google.com/p/pycrc16/downloads

  • extract it with command:

    tar -xzf crc16-0.1.0.tar.gz
  • compile and install the library:

    cd crc16-0.1.0
    python setup.py build
    sudo python setup.py install

    you will need the administrative privileges to execute the last command.

After installation you can run unit tests to make sure that the library works fine. Execute:

python -m crc16.test

Usage

In Python 3:

import crc16
print(crc16.crc16xmodem(b'123456789'))

In Python 2 you should use strings instead of binary data:

import crc16
print(crc16.crc16xmodem('123456789'))

You can also calculate CRC gradually:

import crc16
crc = crc16.crc16xmodem(b'1234')
crc = crc16.crc16xmodem(b'56789', crc)
print(crc)

Other projects

There are a number of projects and libraries for CRC calculation. See for example:

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

crc16-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distributions

crc16-0.1.0.win32-py3.1.exe (208.2 kB view details)

Uploaded Source

crc16-0.1.0.win32-py2.7.exe (208.2 kB view details)

Uploaded Source

crc16-0.1.0.win32-py2.6.exe (208.2 kB view details)

Uploaded Source

File details

Details for the file crc16-0.1.0.tar.gz.

File metadata

  • Download URL: crc16-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crc16-0.1.0.tar.gz
Algorithm Hash digest
SHA256 668d5d7c315fa8b6909a4da0bde3faff93cb54095ebf184a8d1a78054739285b
MD5 f57f01ba3ac87401f023ed9a8d5c08aa
BLAKE2b-256 d71277a198fb4f4eb5163d5ad7f2b5014a8db1d9cb726cca48b865037e883d3e

See more details on using hashes here.

File details

Details for the file crc16-0.1.0.win32-py3.1.exe.

File metadata

File hashes

Hashes for crc16-0.1.0.win32-py3.1.exe
Algorithm Hash digest
SHA256 bd6e423dff904cc9ed5a84dff41f361ea2f4ef49de0f2240cd78d21fc9ab3c67
MD5 1590c7b3cbbf4eb6c722509aa45d4c07
BLAKE2b-256 bc650692fe54fd7dfc09f5e30b7a96a062564d8e0c2848a5b5d9888e2d76f2ea

See more details on using hashes here.

File details

Details for the file crc16-0.1.0.win32-py2.7.exe.

File metadata

File hashes

Hashes for crc16-0.1.0.win32-py2.7.exe
Algorithm Hash digest
SHA256 13dd85df0049404e5a1947b27dc7fa3785da100c635feb6b878e92e07877ee47
MD5 2d981bd4994e60c1b0cdc0dcac2c86ff
BLAKE2b-256 65fb0ec3cdabdaf2578b060c30f7a4b88e2f92395af2e174169fcaa1d708871f

See more details on using hashes here.

File details

Details for the file crc16-0.1.0.win32-py2.6.exe.

File metadata

File hashes

Hashes for crc16-0.1.0.win32-py2.6.exe
Algorithm Hash digest
SHA256 86871ac0bce18070d600fbeed5f9b79a46d662cb63b5e02c99cb79852b072721
MD5 4556f69a32473d5f4adaefba5ea653d7
BLAKE2b-256 529e5ba4ce66c0898cb4a247fb8d3e02ade3a665a72efe103b19242df1acdf79

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