Re: binascii.crc32 results not matching

2005-12-11 Thread Fredrik Lundh
I wrote: > this prints > > 0xF032519BL 0xF032519BL > 0x90E3070AL 0x90E3070AL > > no time to sort out the int/long mess for binascii.crc32, but it pro- > bably needs the same tweaking as PIL (which handles the CRC as > two 16-bit numbers, to avoid sign hell). I realized that I used 2.3 for testing

Re: binascii.crc32 results not matching

2005-12-11 Thread Larry Bates
Thanks so much for the offer, I had a friend do this for me and it works great. Regards, Larry Bates Heiko Wundram wrote: > Larry Bates wrote: > >> >> >>The algorithm looks very much like the source code for >>binascii.crc32 (but I'm not a C programmer). > > > Well... As you have access to the

Re: binascii.crc32 results not matching

2005-12-10 Thread Heiko Wundram
Larry Bates wrote: > > > The algorithm looks very much like the source code for > binascii.crc32 (but I'm not a C programmer). Well... As you have access to the code, you might actually just create a thin Python-Wrapper around this so that you can get comparable results. In case you're unable to

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Larry Bates wrote: 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 in

Re: binascii.crc32 results not matching

2005-12-10 Thread Fredrik Lundh
Larry Bates wrote: > def CalculateCrc(buffer, crc): /snip/ > The algorithm looks very much like the source code for > binascii.crc32 (but I'm not a C programmer). does your Python version give the right result ? if so, the following might be somewhat helpful: def test1(text, crc=0): # l

Re: binascii.crc32 results not matching

2005-12-10 Thread Larry Bates
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

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
Tim Peters wrote: > [Raymond L. Buvel] > >>Check out the unit test in the following. >> >>http://sourceforge.net/projects/crcmod/ > > > Cool! > > >>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 >

Re: binascii.crc32 results not matching

2005-12-10 Thread Tim Peters
[Raymond L. Buvel] > Check out the unit test in the following. > > http://sourceforge.net/projects/crcmod/ Cool! > 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 a

Re: binascii.crc32 results not matching

2005-12-10 Thread Peter Hansen
Raymond L. Buvel wrote: > 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

Re: binascii.crc32 results not matching

2005-12-10 Thread Raymond L. Buvel
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

Re: binascii.crc32 results not matching

2005-12-09 Thread Peter Hansen
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 respo

Re: binascii.crc32 results not matching

2005-12-09 Thread Tim Peters
[Larry Bates] > I'm trying to get the results of binascii.crc32 > to match the results of another utility that produces > 32 bit unsigned CRCs. binascii.crc32 returns > results in the range of -2**31-1 and 2**21-1. Has > anyone ever worked out any "bit twiddling" code to > get a proper unsigned 32

binascii.crc32 results not matching

2005-12-09 Thread Larry Bates
I'm trying to get the results of binascii.crc32 to match the results of another utility that produces 32 bit unsigned CRCs. binascii.crc32 returns results in the range of -2**31-1 and 2**21-1. Has anyone ever worked out any "bit twiddling" code to get a proper unsigned 32 bit result from binascii.