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)
	}
}
