#!/usr/bin/env python3
import hashlib
import requests

filename = "TheConstitution-FullText_TheNationalConstitutionCenter.html"
# Original source copied from here on 20220626 by gneale
# url = "https://constitutioncenter.org/interactive-constitution/full-text"
url = "https://mojopuzzler.org/TheConstitution-FullText_TheNationalConstitutionCenter.html"

print(f"Downloading Constitution from: {url}")
response = requests.get(url)
open(filename, "wb").write(response.content)
print(f"Saved to: {filename}")

with open(filename, "rb") as f:
    bytes = f.read()
    readable_hash = hashlib.sha256(bytes).hexdigest()
    print(f"\nSHA-256 Hash: {readable_hash}")
    print("\nThis hash can be verified against the NFT0 on Chia blockchain:")
    print("https://mintgarden.io/nfts/nft0-nft17vc3hqxm8e52zwtdrcpk6sjuccl63yz5ad4y4eq5me75ta0x72usmf7zj5")