Return the SHA-256 hex digest (64 chars) of the file at path.
(path: Path)
| 119 | |
| 120 | @staticmethod |
| 121 | def hash_file(path: Path) -> str: |
| 122 | """Return the SHA-256 hex digest (64 chars) of the file at path.""" |
| 123 | h = hashlib.sha256() |
| 124 | with path.open("rb") as fh: |
| 125 | for chunk in iter(lambda: fh.read(65536), b""): |
| 126 | h.update(chunk) |
| 127 | return h.hexdigest() |