(binary_stream)
| 23 | hasher = hashlib.sha256() |
| 24 | |
| 25 | def _hash_buf(binary_stream): |
| 26 | buf = binary_stream.read(block_size) # read and page_hash in chunks |
| 27 | while len(buf) > 0: |
| 28 | hasher.update(buf) |
| 29 | buf = binary_stream.read(block_size) |
| 30 | |
| 31 | if isinstance(path_or_stream, Path): |
| 32 | with path_or_stream.open("rb") as afile: |