I'm trying to calculate/generate the CRC32 hash of some random strings using Python but they do not match the values I generate from online sources. Here is what I'm doing on my PC,
>>> import binascii
>>> binascii.crc32('hello-world')
-1311505829
Another approach,
>>> import zlib
>>> zlib.crc32('hello-world')
-1311505829
The fact that the above results are identical tells me that I'm calling the function correctly. But, if I go to the following online sources,
- http://www.lammertbies.nl/comm/info/crc-calculation.html
- http://crc32-checksum.waraxe.us/
- http://www.md5calc.com/ (select CRC32B from drop-down)
For the string "hello-world" they all give the same value = b1d4025b
Does anyone know what I need to do, to get matching results?
As I was typing this question it occurred to me that I might need to convert my Python result to hex,
>>> hex(zlib.crc32('hello-world'))
'-0x4e2bfda5'
Unfortunately, that hasn't helped either. :(
hello-world
, what do you expect to be the CRC32? – Yeohello-world
is0xb1d4025b
as an unsigned int,-0x4e2bfda5
as a signed int. He clearly doesn't know how those two values are related, hence the question. – abarnert