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

Function VerifySignature

crypto/secp256k1/secp256.go:122–130  ·  view source on GitHub ↗

VerifySignature checks that the given pubkey created signature over message. The signature should be in [R || S] format.

(pubkey, msg, signature []byte)

Source from the content-addressed store, hash-verified

120// VerifySignature checks that the given pubkey created signature over message.
121// The signature should be in [R || S] format.
122func VerifySignature(pubkey, msg, signature []byte) bool {
123 if len(msg) != 32 || len(signature) != 64 || len(pubkey) == 0 {
124 return false
125 }
126 sigdata := (*C.uchar)(unsafe.Pointer(&signature[0]))
127 msgdata := (*C.uchar)(unsafe.Pointer(&msg[0]))
128 keydata := (*C.uchar)(unsafe.Pointer(&pubkey[0]))
129 return C.secp256k1_ext_ecdsa_verify(context, sigdata, msgdata, keydata, C.size_t(len(pubkey))) != 0
130}
131
132// DecompressPubkey parses a public key in the 33-byte compressed format.
133// It returns non-nil coordinates if the public key is valid.

Callers 2

VerifyMethod · 0.92
BenchmarkVerifyFunction · 0.92

Calls

no outgoing calls

Tested by 1

BenchmarkVerifyFunction · 0.74