MCPcopy
hub / github.com/tjfoc/gmsm / BenchmarkSM2

Function BenchmarkSM2

sm2/sm2_test.go:86–101  ·  view source on GitHub ↗
(t *testing.B)

Source from the content-addressed store, hash-verified

84}
85
86func BenchmarkSM2(t *testing.B) {
87 t.ReportAllocs()
88 msg := []byte("test")
89 priv, err := GenerateKey(nil) // 生成密钥对
90 if err != nil {
91 t.Fatal(err)
92 }
93 t.ResetTimer()
94 for i := 0; i < t.N; i++ {
95 sign, err := priv.Sign(nil, msg, nil) // 签名
96 if err != nil {
97 t.Fatal(err)
98 }
99 priv.Verify(msg, sign) // 密钥验证
100 }
101}
102
103func TestKEB2(t *testing.T) {
104 ida := []byte{'1', '2', '3', '4', '5', '6', '7', '8',

Callers

nothing calls this directly

Calls 3

GenerateKeyFunction · 0.85
SignMethod · 0.80
VerifyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…