binascii.crc32 results not matching

Raymond L. Buvel levub137 at wi.rr.com
Sat Dec 10 07:53:45 EST 2005


Peter Hansen wrote:
> Larry Bates wrote:
> 
>> I'm trying to get the results of binascii.crc32
>> to match the results of another utility that produces
>> 32 bit unsigned CRCs.  
> 
> 
> What other utility?  As Tim says, there are many CRC32s... the
> background notes on this one happen to stumble out at the top of the
> list in response to googling for "zip file crc32 checksum polynomial",
> though I'm sure there are easier ways.  The binascii docs say its CRC32
> is compatible with the Zip file checksum, but they don't describe it
> further.
> 
> Generally CRCs are described in terms of their "polynomial", though just
> quoting that isn't sufficient to describe their behaviour, but if you
> happen to know the polynomial for your utility, someone else can
> probably point you to a more appropriate routine, or perhaps explain
> what you were doing wrong if the binascii one is actually the right one..
> 
> -Peter
> 

Check out the unit test in the following.

http://sourceforge.net/projects/crcmod/

I went to a lot of trouble to get the results to match the results of
binascii.crc32.  As you will see, there are a couple of extra operations
 even after you get the polynomial and bit ordering correct.

Ray



More information about the Python-list mailing list