Skip to content

Instantly share code, notes, and snippets.

@wileyj
Created December 3, 2020 16:17
Show Gist options
  • Save wileyj/93b4222576cb702053ebfcd3cf9f570b to your computer and use it in GitHub Desktop.
Save wileyj/93b4222576cb702053ebfcd3cf9f570b to your computer and use it in GitHub Desktop.
Verify MD5hash from GCS
import base64
import hashlib
source = [
"/path/to/chainstate.txt", # < -- edit this path
"/path/to//chainstate.txt.sha256" # < -- edit this path
]
for file in source:
hash_md5 = hashlib.md5()
with open(file, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
local_md5 = base64.b64encode(hash_md5.digest()).decode("utf-8")
print("MD5 (%s): %s" % (file, local_md5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment