Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have too many almost-duplicated types and functions related to hash objects, which makes it hard to understand the code and also to add new hash types.
This PR simplifies the hash implementation by consolidating the hash types and functions into a single
evpHash
type. There is only one behavior change: now all hash objects implement the encoding interfaces, but they return an error if the hash is not marshallable. Note that this is not a breaking change, quite the opposite. Hash types implemented by this library have always supported the encoding interfaces, it was in #161 that we conditionally removed it to support the SymCrypt provider. I have made up my mind here, and I now think it is better to just return an error given that upstream Go promises that all the built-in hash types implement the encoding interfaces.