(alg: str, path: Path)
| 16 | |
| 17 | |
| 18 | def get_checksum(alg: str, path: Path) -> str: |
| 19 | h = hashlib.new(alg) |
| 20 | with path.open("rb") as fd: |
| 21 | h.update(fd.read()) |
| 22 | |
| 23 | return base64.urlsafe_b64encode(h.digest()).decode("ascii").rstrip("=") |
| 24 | |
| 25 | |
| 26 | @Analyzer.ID("wheel") |