diff --git a/dsa_test.go b/dsa_test.go index dc6c7f0..fd7296c 100644 --- a/dsa_test.go +++ b/dsa_test.go @@ -230,7 +230,10 @@ func TestDSASignatures(t *testing.T) { func testDsaFixture(f *dsaFixture, t *testing.T) { t.Logf("Testing %s", f.name) - digest := f.alg.digest([]byte(f.message)) + h := f.alg() + h.Write([]byte(f.message)) + digest := h.Sum(nil) + g := f.key.subgroup / 8 if len(digest) > g { digest = digest[0:g] diff --git a/ecdsa_test.go b/ecdsa_test.go index 30daa5d..cc244e7 100644 --- a/ecdsa_test.go +++ b/ecdsa_test.go @@ -416,7 +416,10 @@ func ecdsaLoadInt(s string) (n *big.Int) { func testEcsaFixture(f *ecdsaFixture, t *testing.T) { t.Logf("Testing %s", f.name) - digest := f.alg.digest([]byte(f.message)) + h := f.alg() + h.Write([]byte(f.message)) + digest := h.Sum(nil) + g := f.key.subgroup / 8 if len(digest) > g { digest = digest[0:g] diff --git a/rfc6979.go b/rfc6979.go index 41cb1dd..b3d5941 100644 --- a/rfc6979.go +++ b/rfc6979.go @@ -27,13 +27,6 @@ import ( // A function which provides a fresh Hash (e.g., sha256.New). type HashAlgorithm func() hash.Hash -// digest returns a digest of the given message. -func (alg HashAlgorithm) digest(m []byte) []byte { - h := alg() - h.Write(m) - return h.Sum(nil) -} - // mac returns an HMAC of the given key and message. func (alg HashAlgorithm) mac(k []byte, m []byte) []byte { h := hmac.New(alg, k)