Difficulty comparing generated and google cloud storage provided CRC32c checksums
<p>I am attemptting to get a <code>CRC32c</code> checksum on my local file so I can compare it to the <a href="https://gcloud-python.readthedocs.io/en/latest/storage-blobs.html#gcloud.storage.blob.Blob.crc32c" rel="nofollow">blob.crc32c</a> provided by the gcloud library. Google says I should be using the <a href="http://crcmod.sourceforge.net/crcmod.predefined.html" rel="nofollow">crcmod</a> module in order to actually calculate <code>CRC32c</code> hashes of my data. </p>

<p><code>modifiedFile.txt</code> has already been downloaded from a Google Cloud Storage bucket onto my local filesystem. </p>

<p>The goal here is to set <code>should_download</code> to true only if <code>modifiedFile.txt</code> has a different <code>CRC32c</code> on my local client vs my remote server. How do I get them to generate matching <code>CRC32c</code> in the event that my local filesystem and my gcloud Blob both have the same content?</p>

<pre><code>from crcmod import PredefinedCrc
from gcloud import storage

# blob is a gcloud Blob object

should_download = True

with open('modifiedFile.txt') as f:
  hasher = PredefinedCrc('crc-32c')
  hasher.update(f.read())
  crc32c = hasher.digest()
  print crc32c # \207\245.\240
  print blob.crc32c # CJKo0A==
  should_download = crc32c != blob.crc32c
</code></pre>

<p>Unfortunately, it currently always fails as I don't actually know how to compare the checksum I build with <code>crcmod</code> to the attribute I am seeing in the matching <code>Blob</code> object.</p>