Skip to content

Commit 4293bce

Browse files
use unique hash engine for each file hasher
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 4293bce

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/model_signing/api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,9 @@ 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)
180-
181179
def factory(path: pathlib.Path) -> file.SimpleFileHasher:
182-
return file.SimpleFileHasher(path, algorithm, chunk_size=chunk_size)
180+
hasher = self._build_stream_hasher(hashing_algorithm)
181+
return file.SimpleFileHasher(path, hasher, chunk_size=chunk_size)
183182

184183
return factory
185184

0 commit comments

Comments
 (0)