INNER CODE UNIT · Python

verify_sha256

futo-org/android-keyboard · java/res-bundle/download-bundles.py:29

def verify_sha256(filepath, expected_checksum):
    sha256 = hashlib.sha256()
    with open(filepath, "rb") as f:
        for chunk in iter(lambda: f.read(8192), b""):
            sha256.update(chunk)
    return sha256.hexdigest() == expected_checksum


if __name__ == "__main__":
    root_dir = sys.argv[1]

    for entry in SOURCES:
        raw_default_dir = root_dir + "/raw"
        raw_locale_dir = root_dir + "/raw-" + entry["locale"]

        os.makedirs(raw_default_dir, exist_ok=True)
        os.makedirs(raw_locale_dir, exist_ok=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…