(file_path)
| 246 | |
| 247 | |
| 248 | def compute_hash(file_path): |
| 249 | # 16MB buffer for large file hash computation |
| 250 | BUFFER_SIZE = 1024 * 1024 * 16 |
| 251 | sha256_hash = hashlib.sha256() |
| 252 | with open(file_path, 'rb') as f: |
| 253 | while True: |
| 254 | data = f.read(BUFFER_SIZE) |
| 255 | if not data: |
| 256 | break |
| 257 | sha256_hash.update(data) |
| 258 | return sha256_hash.hexdigest() |
| 259 | |
| 260 | |
| 261 | def file_integrity_validation(file_path, expected_sha256) -> bool: |
no test coverage detected
searching dependent graphs…