From 3729f222cdaeb4debfb58ce4f3ed380a0da716cb Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Thu, 19 Dec 2024 20:38:02 +0530 Subject: [PATCH] optim: avoid div in millerLoopAndFinalExpResult (#1363) --- std/algebra/emulated/sw_bn254/pairing.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/algebra/emulated/sw_bn254/pairing.go b/std/algebra/emulated/sw_bn254/pairing.go index fe0d13b80..a66755246 100644 --- a/std/algebra/emulated/sw_bn254/pairing.go +++ b/std/algebra/emulated/sw_bn254/pairing.go @@ -753,8 +753,8 @@ func (pr Pairing) millerLoopAndFinalExpResult(P *G1Affine, Q *G2Affine, previous t2 := pr.Ext12.Mul(&cubicNonResiduePower, res) t1 := pr.FrobeniusCube(residueWitnessInv) - t0 := pr.FrobeniusSquare(residueWitnessInv) - t1 = pr.Ext12.DivUnchecked(t1, t0) + t0 := pr.FrobeniusSquare(residueWitness) + t1 = pr.Ext12.Mul(t1, t0) t0 = pr.Frobenius(residueWitnessInv) t1 = pr.Ext12.Mul(t1, t0)