(t *testing.B)
| 84 | } |
| 85 | |
| 86 | func 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 | |
| 103 | func TestKEB2(t *testing.T) { |
| 104 | ida := []byte{'1', '2', '3', '4', '5', '6', '7', '8', |
nothing calls this directly
no test coverage detected
searching dependent graphs…