Skip to content

Commit

Permalink
crypto/bls12381: use worst case scalar for input to G1/G2 mul benchma…
Browse files Browse the repository at this point in the history
…rks (#26447)

* test

* crypto/bls12381: use worst case scalar for input to G1/G2 mul benchmarks
  • Loading branch information
jwasinger authored Jan 10, 2023
1 parent ccacb99 commit faff980
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crypto/bls12381/g1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ func BenchmarkG1Add(t *testing.B) {
}

func BenchmarkG1Mul(t *testing.B) {
worstCaseScalar, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
g1 := NewG1()
a, e, c := g1.rand(), q, PointG1{}
a, e, c := g1.rand(), worstCaseScalar, PointG1{}
t.ResetTimer()
for i := 0; i < t.N; i++ {
g1.MulScalar(&c, a, e)
Expand Down
3 changes: 2 additions & 1 deletion crypto/bls12381/g2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ func BenchmarkG2Add(t *testing.B) {
}

func BenchmarkG2Mul(t *testing.B) {
worstCaseScalar, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
g2 := NewG2()
a, e, c := g2.rand(), q, PointG2{}
a, e, c := g2.rand(), worstCaseScalar, PointG2{}
t.ResetTimer()
for i := 0; i < t.N; i++ {
g2.MulScalar(&c, a, e)
Expand Down

0 comments on commit faff980

Please sign in to comment.