crypto: improve comments

This commit is contained in:
Felix Lange 2017-12-06 12:39:54 +01:00
parent c5658996dc
commit d4e098f8ce
2 changed files with 3 additions and 3 deletions

View file

@ -27,7 +27,7 @@ import (
"github.com/ethereum/go-ethereum/crypto/secp256k1" "github.com/ethereum/go-ethereum/crypto/secp256k1"
) )
// Ecrecover returns the public key that created the given signature. // Ecrecover returns the uncompressed public key that created the given signature.
func Ecrecover(hash, sig []byte) ([]byte, error) { func Ecrecover(hash, sig []byte) ([]byte, error) {
return secp256k1.RecoverPubkey(hash, sig) return secp256k1.RecoverPubkey(hash, sig)
} }
@ -61,7 +61,7 @@ func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) {
} }
// VerifySignature checks that the given public key created signature over hash. // VerifySignature checks that the given public key created signature over hash.
// The public key should be in compressed (33 bytes) or uncompressed (64 bytes) format. // The public key should be in compressed (33 bytes) or uncompressed (65 bytes) format.
// The signature should have the 64 byte [R || S] format. // The signature should have the 64 byte [R || S] format.
func VerifySignature(pubkey, hash, signature []byte) bool { func VerifySignature(pubkey, hash, signature []byte) bool {
return secp256k1.VerifySignature(pubkey, hash, signature) return secp256k1.VerifySignature(pubkey, hash, signature)

View file

@ -28,7 +28,7 @@ import (
"github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/btcec"
) )
// Ecrecover returns the public key that created the given signature. // Ecrecover returns the uncompressed public key that created the given signature.
func Ecrecover(hash, sig []byte) ([]byte, error) { func Ecrecover(hash, sig []byte) ([]byte, error) {
pub, err := SigToPub(hash, sig) pub, err := SigToPub(hash, sig)
if err != nil { if err != nil {