On 01-Apr-08, 04:32 (CDT), "\"Adam C?cile (Le_Vert)\"" <[EMAIL PROTECTED]> 
wrote: 
> Hello Steve,
>
> This bug report looks serious however I haven't experienced any problem  
> with python-yenc yet. That's weird.
> Could you give me a quick code snippet that shows the issue ?

>>> import yenc
>>> e = yenc.Encoder()
>>> e.feed("this is a test")
14
>>> e.getCrc32()
'0d1ee7ea'
>>> e.feed("this is a test2")
15
>>> e.getCrc32()
'-7463fdb3'
>>> 

Basically, I just feed data until the CRC goes wonky. It should about
50% of the time. The test script doesn't show it because it just
compares the two wonky CRCs. It only matters if you need the value
externally. If you have the (signed) integer value, you can get it to
convert to (python) long via

        crc32 = crc32 & 0xffffffffL

which hex() then formats correctly.

This actually is a problem with all the CRC32 implementations in Python,
because Python doesn't have an unsigned 32-bit integer.

Steve

-- 
Steve Greenland
    The irony is that Bill Gates claims to be making a stable operating
    system and Linus Torvalds claims to be trying to take over the
    world.       -- seen on the net



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to