Skip to main content

expansions/create_hash.py

1import hashlib
2from pathlib import Path
5def create_hash(path: Path) -> "hashlib._Hash":
6 """
7 Returns the checksum of the given path.
8 """
9 h = hashlib.sha256()
11 with open(path, "rb") as infile:
12 while chunk := infile.read(8192):
13 h.update(chunk)
15 return h