Files
xgcl/sm/sm9/sm9_bench_test.go
T
2026-05-27 23:03:00 +08:00

34 lines
676 B
Go

package sm9
import (
"crypto/rand"
"testing"
)
func BenchmarkSign(b *testing.B) {
uid := []byte("Alice")
msg := []byte("Chinese IBS standard")
ks, pubs, _ := GenerateMastSignPrivateKey(rand.Reader)
ds, _ := GenerateUserSignKey(uid, ks)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = Sign(msg, ds, pubs, nil)
}
}
func BenchmarkVerify(b *testing.B) {
uid := []byte("Alice")
msg := []byte("Chinese IBS standard")
ks, pubs, _ := GenerateMastSignPrivateKey(rand.Reader)
ds, _ := GenerateUserSignKey(uid, ks)
sig, _ := Sign(msg, ds, pubs, nil)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
Verify(sig, uid, msg, pubs)
}
}