lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Jul 4, 2009 at 10:36 AM, KHMan wrote:
> There is no such thing as a negative number in a CRC calculation. If you got
> a negative number displayed, it's in the wrong representation.

For example, be careful if casting an unsigned 32-bit integer as
signed, as in Python 2.6:

$ python
>>> import binascii
>>> binascii.crc32("test")    # might not be what you expected
-662733300
>>> binascii.crc32("test") & 0xffffffff   # workaround
3632233996L