pycrc is a calculation utility that will provide a CRC reference implementation 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 implementations suitable especially for embedded applications.
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 on models with multiples of 8 as width. 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.
Here are some key features of "pycrc":
· Generate the checksum of a string
· Generate the C header and source files for a client implementation. The algorithm can be chosen from fast but big implementation to slower but smaller implementations suitable especially for embedded applications
Requirements:
· Python 2.2.3 or later
What's New in This Release: [ read full changelog ]
· Bad-looking C code generated; make sure the bit-by-bit(fast) code does not
· contain two instructions on one line. Thanks to "intgr" for the fix
· Some small code clean-up: use set() when appropriate
· Added the models crc-12-3gpp, crc-16-genibus, crc-32-bzip2 and crc-64-xz
· Fixed a mistake in the man page that still used the old model name
· crc-32mpeg instead of crc-32-mpeg. Thanks to Marek Erban