fix(hash): HashAlgorithmUnspecified should not be ok

This commit is contained in:
Steve Moyer
2025-07-08 09:42:09 -04:00
parent 8c932e0eb8
commit caaa0204b8

View File

@@ -37,11 +37,10 @@ func DecodeHashAlgorithm(r *bytes.Reader) (HashAlgorithm, error) {
h := HashAlgorithm(u)
if _, ok := map[HashAlgorithm]struct{}{
HashAlgorithmUnspecified: {},
HashAlgorithmSHA256: {},
HashAlgorithmSHA384: {},
HashAlgorithmSHA512: {},
HashAlgorithmShake256: {},
HashAlgorithmSHA256: {},
HashAlgorithmSHA384: {},
HashAlgorithmSHA512: {},
HashAlgorithmShake256: {},
}[h]; !ok {
return HashAlgorithmUnspecified, fmt.Errorf("%w: %x", ErrUnknownHashAlgorithm, h)
}