Skip to content

Commit 86b6aa5

Browse files
use unique hash engine for each file hasher (#326)
Previously, the factory could cause workers to share a hash engine, leading to hashes that were wrong or duplicated. This ultimately created invalid manifests, affecting signature creation and verification. Signed-off-by: Spencer Schrock <[email protected]>
1 parent 9f59620 commit 86b6aa5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/model_signing/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ def _build_file_hasher_factory(
176176
The hasher factory that should be used by the active serialization
177177
method.
178178
"""
179-
algorithm = self._build_stream_hasher(hashing_algorithm)
180179

181180
def factory(path: pathlib.Path) -> file.SimpleFileHasher:
182-
return file.SimpleFileHasher(path, algorithm, chunk_size=chunk_size)
181+
hasher = self._build_stream_hasher(hashing_algorithm)
182+
return file.SimpleFileHasher(path, hasher, chunk_size=chunk_size)
183183

184184
return factory
185185

0 commit comments

Comments
 (0)