Created
December 3, 2020 16:17
-
-
Save wileyj/93b4222576cb702053ebfcd3cf9f570b to your computer and use it in GitHub Desktop.
Verify MD5hash from GCS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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