(zip_path: Path)
| 84 | |
| 85 | |
| 86 | def hash_zip_contents(zip_path: Path) -> list[dict]: |
| 87 | entries = [] |
| 88 | with zipfile.ZipFile(zip_path) as zf: |
| 89 | for info in sorted(zf.infolist(), key=lambda i: i.filename): |
| 90 | if info.is_dir(): |
| 91 | continue |
| 92 | h = hashlib.sha256() |
| 93 | with zf.open(info) as f: |
| 94 | for block in iter(lambda: f.read(CHUNK), b""): |
| 95 | h.update(block) |
| 96 | entries.append( |
| 97 | { |
| 98 | "path": info.filename, |
| 99 | "size": info.file_size, |
| 100 | "sha256": h.hexdigest(), |
| 101 | } |
| 102 | ) |
| 103 | return entries |
| 104 | |
| 105 | |
| 106 | def verify_authenticode(path: Path) -> None: |
no test coverage detected