Skip to content

Commit 9f72d90

Browse files
committed
docs: clean comments
1 parent ce6b81c commit 9f72d90

File tree

1 file changed

+9
-9
lines changed
  • std/algebra/emulated/sw_emulated

1 file changed

+9
-9
lines changed

std/algebra/emulated/sw_emulated/point.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type Curve[Base, Scalars emulated.FieldParams] struct {
6767
// g is the generator (base point) of the curve.
6868
g AffinePoint[Base]
6969

70-
// gm are the pre-computed multiples the generator (base point) of the curve.
70+
// gm are the pre-computed doubles the generator (base point) of the curve.
7171
gm []AffinePoint[Base]
7272

7373
a emulated.Element[Base]
@@ -83,7 +83,7 @@ func (c *Curve[B, S]) Generator() *AffinePoint[B] {
8383
return &c.g
8484
}
8585

86-
// GeneratorMultiples returns the pre-computed multiples of the base point of the curve. The method does not copy and
86+
// GeneratorMultiples returns the pre-computed doubles of the base point of the curve. The method does not copy and
8787
// modifying the returned element leads to undefined behaviour!
8888
func (c *Curve[B, S]) GeneratorMultiples() []AffinePoint[B] {
8989
return c.gm
@@ -498,7 +498,7 @@ func (c *Curve[B, S]) ScalarMul(p *AffinePoint[B], s *emulated.Element[S], opts
498498
}
499499

500500
// scalarMulGLV computes [s]Q using an efficient endomorphism and returns it. It doesn't modify Q nor s.
501-
// It implements algorithm 1 of [Halo] (see Section 6.2 and appendix C).
501+
// It implements an optimized version based on algorithm 1 of [Halo] (see Section 6.2 and appendix C).
502502
//
503503
// ⚠️ The scalar s must be nonzero and the point Q different from (0,0) unless [algopts.WithCompleteArithmetic] is set.
504504
// (0,0) is not on the curve but we conventionally take it as the
@@ -581,8 +581,8 @@ func (c *Curve[B, S]) scalarMulGLV(Q *AffinePoint[B], s *emulated.Element[S], op
581581
// We can compute [2]Acc and look up the (precomputed) point P from:
582582
// B1 = Q+Φ(Q)
583583
// B2 = -Q-Φ(Q)
584-
// B3 = -Φ(Q)+Q
585-
// B4 = Φ(Q)-Q
584+
// B3 = Q-Φ(Q)
585+
// B4 = -QΦ(Q)
586586
//
587587
// If we extend this by merging two iterations, we need to look up P and P'
588588
// both from {B1, B2, B3, B4} and compute:
@@ -665,14 +665,14 @@ func (c *Curve[B, S]) scalarMulGLV(Q *AffinePoint[B], s *emulated.Element[S], op
665665
c.api.Mul(s1bits[i-1], 4),
666666
c.api.Mul(s2bits[i-1], 8),
667667
)
668-
// selectorX takes values in [0,7] with:
668+
// selectorX takes values in [0,7] s.t.:
669669
// - when selectorY < 8: selectorX = selectorY
670670
// - when selectorY >= 8: selectorX = 15 - selectorY
671671
selectorX := c.api.Add(
672672
c.api.Mul(selectorY, c.api.Sub(1, c.api.Mul(s2bits[i-1], 2))),
673673
c.api.Mul(s2bits[i-1], 15),
674674
)
675-
// Bi.Y are distints so we need a 16-to-1 multiplexer,
675+
// Bi.Y are distincts so we need a 16-to-1 multiplexer,
676676
// but only half of the Bi.X are distinct so we need a 8-to-1.
677677
T := &AffinePoint[B]{
678678
X: *c.baseApi.Mux(selectorX,
@@ -1044,14 +1044,14 @@ func (c *Curve[B, S]) jointScalarMulGLVUnsafe(Q, R *AffinePoint[B], s, t *emulat
10441044
c.api.Mul(t1bits[i], 4),
10451045
c.api.Mul(t2bits[i], 8),
10461046
)
1047-
// selectorX takes values in [0,7] with:
1047+
// selectorX takes values in [0,7] s.t.:
10481048
// - when selectorY < 8: selectorX = selectorY
10491049
// - when selectorY >= 8: selectorX = 15 - selectorY
10501050
selectorX := c.api.Add(
10511051
c.api.Mul(selectorY, c.api.Sub(1, c.api.Mul(t2bits[i], 2))),
10521052
c.api.Mul(t2bits[i], 15),
10531053
)
1054-
// Bi.Y are distints so we need a 16-to-1 multiplexer,
1054+
// Bi.Y are distincts so we need a 16-to-1 multiplexer,
10551055
// but only half of the Bi.X are distinct so we need a 8-to-1.
10561056
Bi = &AffinePoint[B]{
10571057
X: *c.baseApi.Mux(selectorX,

0 commit comments

Comments
 (0)