init: v1.0.0

This commit is contained in:
yaole
2026-05-27 23:03:00 +08:00
commit 8d97f750eb
466 changed files with 80067 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
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)
}
}