pycrc
pycrc is a free, easy to use Cyclic Redundancy Check (CRC) calculator and source code generator.
Index ¶
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 chosen, 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 ¶
Download ¶
Older versions can be downloaded from sourceforge.net.
News ¶
Version 0.7.4 released
(24 January 2010)
Version 0.7.4 is a feature enhancement and bug fix release:
- Set xmodem parameters equal to zmodem params.
- Changed the xor-in value of the crc-64-jones model.
- Added crc-16-modbus model. Closes issue 2896611.
- pycrc now writes a warning message if an even polynom is used.
- Fix for unused variable argv. Closes issue 2893224. Thanks to Marko von Oppen.
Version 0.7.3 released
(25 October 2009)
Version 0.7.3 is a small feature enhancement release:
- a new CRC model, crc-64-jones was added. Thanks to Waterspirit.
- crc-32mpeg was renamed to crc-32-mpeg.
10,000 downloads
(10 October 2009)
Today pycrc has passed the threshold of 10,000 downloads.
We hope as many people have enjoyed working with pycrc.
Thanks to everyone who has contributed!
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.
Who uses pycrc ¶
Companies or organisations that use pycrc are:
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 do not have to be 8-bit aligned. (GPL licence)
