package bls import ( "crypto/rand" "github.com/filecoin-project/go-address" "testing" ) func BenchmarkBLSSign(b *testing.B) { signer := blsSigner{} for i := 0; i < b.N; i++ { b.StopTimer() pk, _ := signer.GenPrivate() randMsg := make([]byte, 32) rand.Read(randMsg) b.StartTimer() _, _ = signer.Sign(pk, randMsg) } } func BenchmarkBLSVerify(b *testing.B) { signer := blsSigner{} for i := 0; i < b.N; i++ { b.StopTimer() randMsg := make([]byte, 32) rand.Read(randMsg) priv, _ := signer.GenPrivate() pk, _ := signer.ToPublic(priv) addr, _ := address.NewBLSAddress(pk) sig, _ := signer.Sign(priv, randMsg) b.StartTimer() _ = signer.Verify(sig, addr, randMsg) } }