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.1.tar.gz, from http://code.google.com/p/pycrc16/downloads

  • extract it with command:

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

    cd crc16-0.1.1
    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 Distributions

crc16-0.1.1.zip (20.9 kB view details)

Uploaded Source

crc16-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distributions

crc16-0.1.1.win32-py3.3.exe (202.8 kB view details)

Uploaded Source

crc16-0.1.1.win32-py3.2.exe (208.2 kB view details)

Uploaded Source

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

Uploaded Source

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

Uploaded Source

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

Uploaded Source

File details

Details for the file crc16-0.1.1.zip.

File metadata

  • Download URL: crc16-0.1.1.zip
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for crc16-0.1.1.zip
Algorithm Hash digest
SHA256 1b9f697a93491ae42ed653c1e78ea25a33532afab87b513e6890975450271a01
MD5 9a3ba41c8f8377bb56b8e570c5c7a514
BLAKE2b-256 27f844fab1c8f71faafa1e5bbbb6e38102779846eb17d0e71885e952a5db3d28

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for crc16-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c1f86aa0390f4baf07d2631b16b979580eae1d9a973a826ce45353a22ee8d396
MD5 3cb6a4f5fd10a58c09792e321cc467e5
BLAKE2b-256 a6e070a44c4385f2b33df82e518005aae16b5c1feaf082c73c0acebe3426fc0a

See more details on using hashes here.

File details

Details for the file crc16-0.1.1.win32-py3.3.exe.

File metadata

File hashes

Hashes for crc16-0.1.1.win32-py3.3.exe
Algorithm Hash digest
SHA256 63db8577ce0e03b39f30071166c6667659124a65d7fcd38adffe6a34487ce6fb
MD5 942c5b89ba301333a235c97ece073cc0
BLAKE2b-256 477388a4a3fe1270d36789e34ac21550b21693195251f80191cee149da1b073c

See more details on using hashes here.

File details

Details for the file crc16-0.1.1.win32-py3.2.exe.

File metadata

File hashes

Hashes for crc16-0.1.1.win32-py3.2.exe
Algorithm Hash digest
SHA256 521643768ff000a7758bc1f1c5e1dc41ae64b42fa57c50e133ab083cfaf9b8f9
MD5 4a51f1f6f9c9b827c51554f14643db59
BLAKE2b-256 33cce338915627c0b148c378ae249105e37efe31f70b1fb7d84e81f3c88a6dab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crc16-0.1.1.win32-py3.1.exe
Algorithm Hash digest
SHA256 1439e3cc0244a4758aa2d40a31b062086c24f5602046ec2fa4356484c4b5a385
MD5 a5a9cb57e68a88b6870402054efb496b
BLAKE2b-256 d9d732338df319b6b8845d0ae3b32a0bdb58ebbde76cf3dde3471f4cf7bd7ed6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crc16-0.1.1.win32-py2.7.exe
Algorithm Hash digest
SHA256 7998bb0cacb0005ba62f963540c0f7cb09e86b51f6b4e64ed5632f31a7266fa1
MD5 9dcfeeae6896a93dc209e0d04ee7fe24
BLAKE2b-256 62b4b6ee4d4019542ccac4eab0fec34da101235fce6b82128f146f933355ed06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crc16-0.1.1.win32-py2.6.exe
Algorithm Hash digest
SHA256 eb47b9cec9818b684537d05552ff10404c92d9dcdd455156456b19e7423855bc
MD5 8de4344fd58143db6570ab6049db6d79
BLAKE2b-256 3c8a745b9c24ac19c6941e38ecf29ed3b2e564e796485426642c102fe84520c4

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