MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / TestRecoverSanity

Function TestRecoverSanity

crypto/secp256k1/secp256_test.go:206–217  ·  view source on GitHub ↗

Useful when the underlying libsecp256k1 API changes to quickly check only recover function without use of signature function.

(t *testing.T)

Source from the content-addressed store, hash-verified

204// Useful when the underlying libsecp256k1 API changes to quickly
205// check only recover function without use of signature function.
206func TestRecoverSanity(t *testing.T) {
207 msg, _ := hex.DecodeString("ce0677bb30baa8cf067c88db9811f4333d131bf8bcf12fe7065d211dce971008")
208 sig, _ := hex.DecodeString("90f27b8b488db00b00606796d2987f6a5f59ae62ea05effe84fef5b8b0e549984a691139ad57a3f0b906637673aa2f63d1f55cb1a69199d4009eea23ceaddc9301")
209 pubkey1, _ := hex.DecodeString("04e32df42865e97135acfb65f3bae71bdc86f4d49150ad6a440b6f15878109880a0a2b2667f7e725ceea70c673093bf67663e0312623c8e091b13cf2c0f11ef652")
210 pubkey2, err := RecoverPubkey(msg, sig)
211 if err != nil {
212 t.Fatalf("recover error: %s", err)
213 }
214 if !bytes.Equal(pubkey1, pubkey2) {
215 t.Errorf("pubkey mismatch: want: %x have: %x", pubkey1, pubkey2)
216 }
217}
218
219func BenchmarkSign(b *testing.B) {
220 _, seckey := generateKeyPair()

Callers

nothing calls this directly

Calls 3

RecoverPubkeyFunction · 0.85
FatalfMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected