Deduplicate digests from user configuration (#2522)

* deduplicate digests from user configuration

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* backout pointer reciever change on imageSource

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2024-01-19 21:51:55 +00:00
committed by GitHub
parent 0bc31f4e27
commit 3eab5932e5
9 changed files with 180 additions and 3 deletions
+2 -1
View File
@@ -22,6 +22,7 @@ func supportedHashAlgorithms() []crypto.Hash {
}
func NewDigestsFromFile(closer io.ReadCloser, hashes []crypto.Hash) ([]file.Digest, error) {
hashes = NormalizeHashes(hashes)
// create a set of hasher objects tied together with a single writer to feed content into
hashers := make([]hash.Hash, len(hashes))
writers := make([]io.Writer, len(hashes))
@@ -67,7 +68,7 @@ func Hashers(names ...string) ([]crypto.Hash, error) {
}
hashers = append(hashers, hashObj)
}
return hashers, nil
return NormalizeHashes(hashers), nil
}
func CleanDigestAlgorithmName(name string) string {