From 0dfe5113709d2981ef2ec8885d831a38cf2e4f91 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 22 Jan 2015 18:15:11 +0100 Subject: [PATCH] Use curve params instead of hardcoded 32 bytes --- crypto/crypto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/crypto.go b/crypto/crypto.go index 3da69ea94..93453b91c 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -106,7 +106,7 @@ func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) { return nil, fmt.Errorf("hash is required to be exactly 32 bytes (%d)", len(hash)) } - sig, err = secp256k1.Sign(hash, ethutil.LeftPadBytes(prv.D.Bytes(), 32)) + sig, err = secp256k1.Sign(hash, ethutil.LeftPadBytes(prv.D.Bytes(), prv.Params().BitSize/8)) return }