MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / CompressPubkey

Function CompressPubkey

crypto/secp256k1/secp256.go:152–165  ·  view source on GitHub ↗

CompressPubkey encodes a public key to 33-byte compressed format.

(x, y *big.Int)

Source from the content-addressed store, hash-verified

150
151// CompressPubkey encodes a public key to 33-byte compressed format.
152func CompressPubkey(x, y *big.Int) []byte {
153 var (
154 pubkey = S256().Marshal(x, y)
155 pubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0]))
156 pubkeylen = C.size_t(len(pubkey))
157 out = make([]byte, 33)
158 outdata = (*C.uchar)(unsafe.Pointer(&out[0]))
159 outlen = C.size_t(len(out))
160 )
161 if C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 {
162 panic("libsecp256k1 error")
163 }
164 return out
165}
166
167func checkSignature(sig []byte) error {
168 if len(sig) != 65 {

Callers

nothing calls this directly

Calls 2

MarshalMethod · 0.80
S256Function · 0.70

Tested by

no test coverage detected