Skip to content

Commit

Permalink
refactor: apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
yelhousni committed Jan 16, 2025
1 parent d11a01a commit c0e7c58
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ecc/bw6-761/pairing.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,18 @@ func (p *G2Affine) tangentCompute(evaluations *LineEvaluationAff) {
// Alg.2 in https://eprint.iacr.org/2021/1359.pdf
// Eq. (6') in https://hackmd.io/@gnark/BW6-761-changes
func MillerLoopDirect(P []G1Affine, Q []G2Affine) (GT, error) {
// check input size match
n := len(P)
if n == 0 {
return GT{}, errors.New("invalid inputs sizes")
}

lines := make([][2][len(LoopCounter) - 1]LineEvaluationAff, 0, len(Q))
for _, qi := range Q {
lines = append(lines, PrecomputeLines(qi))
}

// check input size match
n := len(P)
if n == 0 || n != len(lines) {
if n != len(Q) {
return GT{}, errors.New("invalid inputs sizes")
}

Expand Down Expand Up @@ -695,7 +699,7 @@ func MillerLoopDirect(P []G1Affine, Q []G2Affine) (GT, error) {
var result fptower.E6D
result.SetOne()

for i := 188; i >= 0; i-- {
for i := len(LoopCounter) - 2; i >= 0; i-- {
result.Square(&result)

j := LoopCounter1[i]*3 + LoopCounter[i]
Expand Down

0 comments on commit c0e7c58

Please sign in to comment.