package sm9 import ( "crypto/rand" "fmt" "testing" "xdx.jelly/xgcl/internal" ) func TestReportSpeed(T *testing.T) { uid := []byte("Alice") msg := []byte("Chinese IBS standard") ks, pubs, _ := GenerateMastSignPrivateKey(rand.Reader) ds, _ := ks.GenerateUserSignKey(uid) count, duation := internal.SingleThreadTester(func() { ds, _ = ks.GenerateUserSignKey(uid) }) fmt.Printf("Generate User key: %d, used time: %d ms, %d pcs/s\n", count, duation.Milliseconds(), int(internal.Rate(count, duation))) var sig *Signature count, duation = internal.SingleThreadTester(func() { sig, _ = Sign(msg, ds, pubs, nil) }) fmt.Printf("Sign %d, used time: %d ms, %d pcs/s\n", count, duation.Milliseconds(), int(internal.Rate(count, duation))) count, duation = internal.SingleThreadTester(func() { Verify(sig, uid, msg, pubs) }) fmt.Printf("Verify %d, used time: %d ms, %d pcs/s\n", count, duation.Milliseconds(), int(internal.Rate(count, duation))) }