Generate SHA-256 hash for a single file.
(file_path)
| 60 | |
| 61 | |
| 62 | def hash_file(file_path): |
| 63 | """Generate SHA-256 hash for a single file.""" |
| 64 | hasher = hashlib.sha256() |
| 65 | with open(file_path, "rb") as f: |
| 66 | # Read the file in chunks to avoid memory issues |
| 67 | for chunk in iter(lambda: f.read(4096), b""): |
| 68 | hasher.update(chunk) |
| 69 | return hasher.hexdigest() |
| 70 | |
| 71 | |
| 72 | def hash_files(file_paths): |
no test coverage detected