Larry Bates wrote: <snip a lot of code> Looking over the code, it seems very inefficient and hard to understand. You really should check out the following.
http://sourceforge.net/projects/crcmod/ It will allow you to generate efficient CRC functions for use in Python and in C or C++. The only thing you need to input is the polynomial, the bit ordering, and the starting value. The unit test gives a number of polynomials including the one you are using which is: polynomial: 0x104C11DB7, bit reverse algorithm If you are just looking for a utility on Linux to do nightly checking of files, I strongly recommend md5sum. My timing tests indicate that the MD5 algorithm is comparable or slightly faster than a 32-bit CRC and certainly faster than the code you are trying to port. It also has the advantage of being a standard Linux command so you don't need to code anything. Ray -- http://mail.python.org/mailman/listinfo/python-list