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

Function BenchmarkGenKeySignVerify

crypto/asymmetric/signature_test.go:168–189  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

166}
167
168func BenchmarkGenKeySignVerify(b *testing.B) {
169 b.Log(b.Name())
170 b.ReportAllocs()
171 b.ResetTimer()
172
173 for i := 0; i < b.N; i++ {
174 //hash := make([]byte, 32)
175 //rand.Read(hash)
176 hash := []byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
177 priv, pub, err := GenSecp256k1KeyPair()
178 if err != nil {
179 b.Fatalf("error occurred: %v", err)
180 }
181 sig, err := priv.Sign(hash[:])
182 if err != nil {
183 b.Fatalf("error occurred: %d, %v", i, err)
184 }
185 if !sig.Verify(hash[:], pub) {
186 b.Fatalf("error occurred: %d", i)
187 }
188 }
189}
190
191func generateKeyPair() (pubkey, privkey []byte) {
192 key, err := ecdsa.GenerateKey(secp256k1.S256(), crand.Reader)

Callers

nothing calls this directly

Calls 5

GenSecp256k1KeyPairFunction · 0.85
NameMethod · 0.80
FatalfMethod · 0.80
SignMethod · 0.65
VerifyMethod · 0.65

Tested by

no test coverage detected