feat(hashes): shorten HashAlgorithm to Hash, add more of them

This commit is contained in:
Michael Muré
2025-07-22 11:27:24 +02:00
parent c7a870e9db
commit 0763d6f8b6
9 changed files with 78 additions and 45 deletions

View File

@@ -46,12 +46,12 @@ type EdDSAVarsig struct {
varsig
curve EdDSACurve
hashAlg HashAlgorithm
hashAlg Hash
}
// NewEdDSAVarsig creates and validates an EdDSA varsig with the provided
// curve, hash algorithm and payload encoding.
func NewEdDSAVarsig(curve EdDSACurve, hashAlgorithm HashAlgorithm, payloadEncoding PayloadEncoding, opts ...Option) (EdDSAVarsig, error) {
func NewEdDSAVarsig(curve EdDSACurve, hashAlgorithm Hash, payloadEncoding PayloadEncoding, opts ...Option) (EdDSAVarsig, error) {
options := newOptions(opts...)
var (
@@ -85,9 +85,9 @@ func (v EdDSAVarsig) Curve() EdDSACurve {
return v.curve
}
// HashAlgorithm returns the value describing the hash algorithm used to hash
// Hash returns the value describing the hash algorithm used to hash
// the payload content before the signature is generated.
func (v EdDSAVarsig) HashAlgorithm() HashAlgorithm {
func (v EdDSAVarsig) Hash() Hash {
return v.hashAlg
}