pycrc
pycrc is a free, fully parametrisable Cyclic Redundancy Check (CRC) calculator and C source code generator written in Python.
Index
Description
Documentation
Download
News
To Do
CRC links
Description
pycrc provides CRC reference implementations in Python and a source code generator for C.
The used CRC variant can be chosen from a fast but space-consuming implementation to slower but smaller versions
especially suitable for embedded applications.
The models can be freely cosen, but a comprehensive collection of CRC models
is available by name.
The following functions are implemented:
-
calculate the checksum of a string or a file.
-
generate the source files for a "C" implementation.
The following variants of the CRC algorithm are supported:
-
bit-by-bit: the basic algorithm which operates individually on every bit of the augmented message
(i.e. the input data with width 0-bits attached to the end).
This algorithm is the easiest one to understand, because it's a direct implementation of the basic polynomial division,
but it is also the slowest among all possible variants.
-
bit-by-bit-fast: a variation of the simple bit-by-bit algorithm,
which doesn't need the augmented message.
This algorithm might be a good choice for embedded platforms, where code space is a major concern.
-
table-driven: the standard table driven algorithm. This algorithm works only with
models where width is a multiple of 8.
This is the fastest variant, because it operates on bytes as opposed to bits, and uses a look-up table of 256 elements, which might
not be feasible for small embedded systems, though. Anyway, the number of elements in the look-up table can be reduced by means of
the --table_idx_with command line switch. By using 4 bits (16 elements in the look-up table) a significant
speed-up can be measured with respect to the bit-by-bit algorithms.
pycrc is released under the terms of the MIT licence.
Documentation
Man page
List of supported CRC models
FAQ
pycrc-users Mailing list
Download
The most recent version is:
pycrc-0.6.7.tar.gz
pycrc-0.6.7.zip
Older versions can be downloaded from sourceforge.net.
News
Version 0.6.7 released
(11 December 2008)
Version 0.6.7 of pycrc is just a small bugfix release:
- The code should run on both Python 2.x and 3.0.
- Fixed a bug that gave wrong results on x64 platforms.
- Fixed a bug that raised an exception when an unknown model was selected.
Please check the ChangeLog file for a detailed list of changes.
Version 0.6.6 released
(06 June 2008)
Version 0.6.6 of pycrc is just a small bugfix release:
- Fixed a bug in the print_params function. Closes issue 1985197. Thanks to Artur Lipowski.
- Creative Commons license for the documentation.
Please check the ChangeLog file for a detailed list of changes.
Version 0.6.5 released
(02 March 2008)
Version 0.6.5 of adds a few new CRC models (dallas-1-wire, r-crc-16, thanks to "raimondo") and contains the following changes:
- fixed a problem with the generated code for bit-by-bit-fast algorithms. Thanks to Hans Bacher.
- added extern "C" declaration to the generated C header file. Thanks to Nathan Royer.
- added --crc-type and --include-file options.
Please check the ChangeLog file for a detailed list of changes.
All news can be read in the pycrc news archive.
To Do
- pycrc is considered stable code. No new features are planned, but bugs are still fixed and new models added on request.
Check out pycrc's issue tracker for other open bugs and feature requests.
CRC links
- crc-generator is a Python module which calculates the CRC and generates C source code. (MIT licence)
- CrcMoose is another CRC Python module, able to generate a CRC of arbitrary models and it contains a long list of CRC models. (MIT licence)
- Universal Crc is a C program that generates fast C source code. It is noteworthy that it can generate a table-driven algorithm for polynoms which does not have to be 8-bit aligned. (GPL licence)