From e305754990234619d2c870b517555d99e4717522 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic <steven.lerouzic@gmail.com> Date: Wed, 4 Jun 2025 19:27:53 +0200 Subject: Refer to ASL using archives --- integrity.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 integrity.py (limited to 'integrity.py') diff --git a/integrity.py b/integrity.py deleted file mode 100644 index 14bfe66..0000000 --- a/integrity.py +++ /dev/null @@ -1,34 +0,0 @@ -import sys -import hashlib -import base64 -from pathlib import Path -import requests - -def file_hash(file_path: Path) -> str: - sha256_hash = hashlib.sha256() - with open(file_path, "rb") as file: - while True: - data = file.read(65536) - if not data: - break - sha256_hash.update(data) - return "sha256-" + base64.b64encode(sha256_hash.digest()).decode() - -def url_hash(url: str) -> str: - sha256_hash = hashlib.sha256() - with requests.get(url, stream=True) as resp: - resp.raise_for_status() - while True: - data = resp.raw.read(65536) - if not data: - break - sha256_hash.update(data) - return "sha256-" + base64.b64encode(sha256_hash.digest()).decode() - -if __name__ == "__main__" and len(sys.argv) > 1: - path = Path(sys.argv[1]) - if path.exists(): - print(file_hash(path)) - else: - print(url_hash(sys.argv[1])) - -- cgit