there is no place like ~

pycrc FAQ

General questions

Why yet another CRC tool?

Because I couldn't find any program which met my needs. I wanted an Open Source tool with the following features:

Python implementation

But the Python implementation is extremely inefficient!

This is correct. And I'm not going to change this. The Python implementation is thought to provide a correct, stable and easy to read code bases for further experiments. The right place to do performance tuning is the generated C code. I'm happy to consider every suggestion to improve the generated code.

CRC source generator

Which is the best model?

This depends. For occasional computations on small amounts of data the optimized bit-by-bit implementation might be a feasable solution and might also have a speed which is comparable to other models. On desktop computers, with larger amounts of data, the table driven model is a good choice, but on embedded platforms, where code space is a major concern, an optimized bit-by-bit implementation might be the better choice.

Parameters Width Platform Data quantity Possible algorithms
Variable, Fixed 1-16 bits Embedded, Desktop Low bit-by-bit, bit-by-bit-fast
Fixed 8, 16 bits Embedded, Desktop Medium, Low bit-by-bit-fast, table-driven (table index width: 4)
Fixed 8 or more bits Desktop Medium, High table-driven

How fast are the algorithms?

The following numbers are gathered from a unspecified computer using an unspecified compiler (at maximum optimisation level). The numbers (in an unspecified time unit) are meaningful to compare the performance of the algorithms on this particular setup.

Algorithm Looping over User time
bit-by-bit 65536 blocks of 1024 bytes each 7.590
bit-by-bit 65536 * 1024 bytes 8.260
bit-by-bit-fast 65536 blocks of 1024 bytes each 6.450
bit-by-bit-fast 65536 * 1024 bytes 7.280
table-driven 65536 blocks of 1024 bytes each 0.320
table-driven 65536 * 1024 bytes 0.760
table-driven (table index width: 4) 65536 blocks of 1024 bytes each 0.720
table-driven (table index width: 4) 65536 * 1024 bytes 1.190

Who owns the generated code?

This question has become almost irrelevant with the MIT licence introduced in version 0.6. The sloppy answer is: you are free to do whatever you like with pycrc's the output, as long as the terms of the MIT licence are not violated.