Quantcast
Viewing all articles
Browse latest Browse all 14389

How to calculate CRC32 with Python to match online results?

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,

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.


Viewing all articles
Browse latest Browse all 14389

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>