aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/signature_nocgo.go
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/signature_nocgo.go')
-rw-r--r--crypto/signature_nocgo.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/signature_nocgo.go b/crypto/signature_nocgo.go
index 17fd613b2..78b99c02b 100644
--- a/crypto/signature_nocgo.go
+++ b/crypto/signature_nocgo.go
@@ -102,6 +102,11 @@ func DecompressPubkey(pubkey []byte) (*ecdsa.PublicKey, error) {
return key.ToECDSA(), nil
}
+// CompressPubkey encodes a public key to the 33-byte compressed format.
+func CompressPubkey(pubkey *ecdsa.PublicKey) []byte {
+ return (*btcec.PublicKey)(pubkey).SerializeCompressed()
+}
+
// S256 returns an instance of the secp256k1 curve.
func S256() elliptic.Curve {
return btcec.S256()