title: How to calculate CRC32 with Python to match online results?
body: <p>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,</p>
  
  <pre><code>&gt;&gt;&gt; import binascii
  &gt;&gt;&gt; binascii.crc32('hello-world')
  -1311505829
  </code></pre>
  
  <p>Another approach,</p>
  
  <pre><code>&gt;&gt;&gt; import zlib
  &gt;&gt;&gt; zlib.crc32('hello-world')
  -1311505829
  </code></pre>
  
  <p>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,</p>
  
  <ul>
  <li><a href="http://www.lammertbies.nl/comm/info/crc-calculation.html" rel="noreferrer">http://www.lammertbies.nl/comm/info/crc-calculation.html</a></li>
  <li><a href="http://crc32-checksum.waraxe.us/" rel="noreferrer">http://crc32-checksum.waraxe.us/</a> </li>
  <li><a href="http://www.md5calc.com/" rel="noreferrer">http://www.md5calc.com/</a>   (select CRC32B from drop-down)</li>
  </ul>
  
  <p>For the string "hello-world" they all give the same value = b1d4025b</p>
  
  <p>Does anyone know what I need to do, to get matching results?</p>
  
  <p>As I was typing this question it occurred to me that I might need to convert my Python result to hex,</p>
  
  <pre><code>&gt;&gt;&gt; hex(zlib.crc32('hello-world'))
  '-0x4e2bfda5'
  </code></pre>
  
  <p>Unfortunately, that hasn't helped either. :(</p>