crypto: add comment to FromECDSAPub (#31241)

closes https://github.com/ethereum/go-ethereum/issues/26240
pull/31246/head
Marius van der Wijden 1 day ago committed by GitHub
parent a0e6381c48
commit fbe0005070
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      crypto/crypto.go

@ -184,6 +184,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
} }
// FromECDSAPub converts a secp256k1 public key to bytes.
// Note: it does not use the curve from pub, instead it always
// encodes using secp256k1.
func FromECDSAPub(pub *ecdsa.PublicKey) []byte { func FromECDSAPub(pub *ecdsa.PublicKey) []byte {
if pub == nil || pub.X == nil || pub.Y == nil { if pub == nil || pub.X == nil || pub.Y == nil {
return nil return nil

Loading…
Cancel
Save