From d4ee6960397f4876de84172cdf64209b90393a3c Mon Sep 17 00:00:00 2001 From: Youssef El Housni Date: Thu, 28 Jul 2022 10:32:59 +0100 Subject: [PATCH] docs: correct some comments --- ecc/bls12-377/g1.go | 2 +- ecc/bls12-377/g2.go | 2 +- ecc/bls12-377/internal/fptower/e12.go | 2 +- ecc/bls12-378/g1.go | 2 +- ecc/bls12-378/g2.go | 2 +- ecc/bls12-378/internal/fptower/e12.go | 2 +- ecc/bls12-381/g1.go | 2 +- ecc/bls12-381/g2.go | 2 +- ecc/bls12-381/internal/fptower/e12.go | 2 +- ecc/bls12-381/internal/fptower/e2_bls381.go | 2 +- ecc/bls24-315/g1.go | 2 +- ecc/bls24-315/g2.go | 2 +- ecc/bls24-315/internal/fptower/e12.go | 2 +- ecc/bls24-315/internal/fptower/e24.go | 2 +- ecc/bls24-317/g1.go | 2 +- ecc/bls24-317/g2.go | 2 +- ecc/bls24-317/internal/fptower/e12.go | 2 +- ecc/bls24-317/internal/fptower/e24.go | 2 +- ecc/bn254/g1.go | 2 +- ecc/bn254/g2.go | 2 +- ecc/bn254/internal/fptower/e12.go | 2 +- ecc/bn254/internal/fptower/e2_bn254.go | 2 +- ecc/bw6-633/g1.go | 2 +- ecc/bw6-633/g2.go | 2 +- ecc/bw6-756/g1.go | 2 +- ecc/bw6-756/g2.go | 2 +- ecc/bw6-761/g1.go | 2 +- ecc/bw6-761/g2.go | 2 +- internal/generator/ecc/template/point.go.tmpl | 2 +- internal/generator/tower/asm/amd64/e2_bls381.go | 2 +- internal/generator/tower/template/fq12over6over2/fq12.go.tmpl | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ecc/bls12-377/g1.go b/ecc/bls12-377/g1.go index f93ed7e3ee..4a39ccf7c5 100644 --- a/ecc/bls12-377/g1.go +++ b/ecc/bls12-377/g1.go @@ -344,7 +344,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls12-377/g2.go b/ecc/bls12-377/g2.go index ac68e3c2e4..c80b5bdee0 100644 --- a/ecc/bls12-377/g2.go +++ b/ecc/bls12-377/g2.go @@ -341,7 +341,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls12-377/internal/fptower/e12.go b/ecc/bls12-377/internal/fptower/e12.go index b93d3fd2e5..0667a8769d 100644 --- a/ecc/bls12-377/internal/fptower/e12.go +++ b/ecc/bls12-377/internal/fptower/e12.go @@ -461,7 +461,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bls12-378/g1.go b/ecc/bls12-378/g1.go index 52624acb85..6384c93dfb 100644 --- a/ecc/bls12-378/g1.go +++ b/ecc/bls12-378/g1.go @@ -344,7 +344,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls12-378/g2.go b/ecc/bls12-378/g2.go index 44789a1269..143474f59f 100644 --- a/ecc/bls12-378/g2.go +++ b/ecc/bls12-378/g2.go @@ -341,7 +341,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls12-378/internal/fptower/e12.go b/ecc/bls12-378/internal/fptower/e12.go index 6effa680ce..e565fba91a 100644 --- a/ecc/bls12-378/internal/fptower/e12.go +++ b/ecc/bls12-378/internal/fptower/e12.go @@ -461,7 +461,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bls12-381/g1.go b/ecc/bls12-381/g1.go index 1c2daaa560..26e21d85aa 100644 --- a/ecc/bls12-381/g1.go +++ b/ecc/bls12-381/g1.go @@ -344,7 +344,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls12-381/g2.go b/ecc/bls12-381/g2.go index d129abb7fb..d2e3a4b91c 100644 --- a/ecc/bls12-381/g2.go +++ b/ecc/bls12-381/g2.go @@ -341,7 +341,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls12-381/internal/fptower/e12.go b/ecc/bls12-381/internal/fptower/e12.go index ff3fe731ef..9cae3274bc 100644 --- a/ecc/bls12-381/internal/fptower/e12.go +++ b/ecc/bls12-381/internal/fptower/e12.go @@ -461,7 +461,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bls12-381/internal/fptower/e2_bls381.go b/ecc/bls12-381/internal/fptower/e2_bls381.go index fd6a6a2ecb..ac1a243da2 100644 --- a/ecc/bls12-381/internal/fptower/e2_bls381.go +++ b/ecc/bls12-381/internal/fptower/e2_bls381.go @@ -37,7 +37,7 @@ func mulGenericE2(z, x, y *E2) { // Square sets z to the E2-product of x,x returns z func squareGenericE2(z, x *E2) *E2 { - // algo 22 https://eprint.iacr.org/2010/354.pdf + // adapted from algo 22 https://eprint.iacr.org/2010/354.pdf var a, b fp.Element a.Add(&x.A0, &x.A1) b.Sub(&x.A0, &x.A1) diff --git a/ecc/bls24-315/g1.go b/ecc/bls24-315/g1.go index c5d5ccd8b0..c97b141497 100644 --- a/ecc/bls24-315/g1.go +++ b/ecc/bls24-315/g1.go @@ -344,7 +344,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls24-315/g2.go b/ecc/bls24-315/g2.go index 538191e50e..81fb7f6427 100644 --- a/ecc/bls24-315/g2.go +++ b/ecc/bls24-315/g2.go @@ -341,7 +341,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls24-315/internal/fptower/e12.go b/ecc/bls24-315/internal/fptower/e12.go index faa9d387c8..6a9fc75b2c 100644 --- a/ecc/bls24-315/internal/fptower/e12.go +++ b/ecc/bls24-315/internal/fptower/e12.go @@ -250,7 +250,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bls24-315/internal/fptower/e24.go b/ecc/bls24-315/internal/fptower/e24.go index 1dde697a78..111465892b 100644 --- a/ecc/bls24-315/internal/fptower/e24.go +++ b/ecc/bls24-315/internal/fptower/e24.go @@ -459,7 +459,7 @@ func (z *E24) Exp(x E24, k *big.Int) *E24 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q²⁴) == (x⁻¹)ᵏ (mod q²⁴) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bls24-317/g1.go b/ecc/bls24-317/g1.go index 29bfa471b3..24670352e6 100644 --- a/ecc/bls24-317/g1.go +++ b/ecc/bls24-317/g1.go @@ -344,7 +344,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls24-317/g2.go b/ecc/bls24-317/g2.go index 683e112cbd..bf9e978856 100644 --- a/ecc/bls24-317/g2.go +++ b/ecc/bls24-317/g2.go @@ -341,7 +341,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bls24-317/internal/fptower/e12.go b/ecc/bls24-317/internal/fptower/e12.go index 785fea776d..709f3131ed 100644 --- a/ecc/bls24-317/internal/fptower/e12.go +++ b/ecc/bls24-317/internal/fptower/e12.go @@ -250,7 +250,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bls24-317/internal/fptower/e24.go b/ecc/bls24-317/internal/fptower/e24.go index 94cd04511c..ef91e3d7e5 100644 --- a/ecc/bls24-317/internal/fptower/e24.go +++ b/ecc/bls24-317/internal/fptower/e24.go @@ -459,7 +459,7 @@ func (z *E24) Exp(x E24, k *big.Int) *E24 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q²⁴) == (x⁻¹)ᵏ (mod q²⁴) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bn254/g1.go b/ecc/bn254/g1.go index f9f94fa01d..872d8218c9 100644 --- a/ecc/bn254/g1.go +++ b/ecc/bn254/g1.go @@ -344,7 +344,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bn254/g2.go b/ecc/bn254/g2.go index 1939b3f32e..0a8625caa2 100644 --- a/ecc/bn254/g2.go +++ b/ecc/bn254/g2.go @@ -341,7 +341,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bn254/internal/fptower/e12.go b/ecc/bn254/internal/fptower/e12.go index d3b613a6e5..3ce92d8317 100644 --- a/ecc/bn254/internal/fptower/e12.go +++ b/ecc/bn254/internal/fptower/e12.go @@ -461,7 +461,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since diff --git a/ecc/bn254/internal/fptower/e2_bn254.go b/ecc/bn254/internal/fptower/e2_bn254.go index cd59a2efee..f0a619dcb9 100644 --- a/ecc/bn254/internal/fptower/e2_bn254.go +++ b/ecc/bn254/internal/fptower/e2_bn254.go @@ -50,7 +50,7 @@ func mulGenericE2(z, x, y *E2) { // squareGenericE2 sets z to the E2-product of x,x returns z // note: do not rename, this is referenced in the x86 assembly impl func squareGenericE2(z, x *E2) { - // algo 22 https://eprint.iacr.org/2010/354.pdf + // adapted from algo 22 https://eprint.iacr.org/2010/354.pdf var a, b fp.Element a.Add(&x.A0, &x.A1) b.Sub(&x.A0, &x.A1) diff --git a/ecc/bw6-633/g1.go b/ecc/bw6-633/g1.go index c74faf1d84..0228f01bbd 100644 --- a/ecc/bw6-633/g1.go +++ b/ecc/bw6-633/g1.go @@ -349,7 +349,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bw6-633/g2.go b/ecc/bw6-633/g2.go index 20d3c4b377..33adec5f32 100644 --- a/ecc/bw6-633/g2.go +++ b/ecc/bw6-633/g2.go @@ -336,7 +336,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bw6-756/g1.go b/ecc/bw6-756/g1.go index 5ffaa9a826..899113c8d1 100644 --- a/ecc/bw6-756/g1.go +++ b/ecc/bw6-756/g1.go @@ -349,7 +349,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bw6-756/g2.go b/ecc/bw6-756/g2.go index fbcd9c4eee..3abfa71d5a 100644 --- a/ecc/bw6-756/g2.go +++ b/ecc/bw6-756/g2.go @@ -336,7 +336,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bw6-761/g1.go b/ecc/bw6-761/g1.go index 8e68f70406..0263285ab7 100644 --- a/ecc/bw6-761/g1.go +++ b/ecc/bw6-761/g1.go @@ -349,7 +349,7 @@ func (p *G1Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G1Jac) FromAffine(Q *G1Affine) *G1Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/ecc/bw6-761/g2.go b/ecc/bw6-761/g2.go index a15998b959..a56f3dfeb7 100644 --- a/ecc/bw6-761/g2.go +++ b/ecc/bw6-761/g2.go @@ -336,7 +336,7 @@ func (p *G2Jac) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *G2Jac) FromAffine(Q *G2Affine) *G2Jac { if Q.IsInfinity() { p.Z.SetZero() diff --git a/internal/generator/ecc/template/point.go.tmpl b/internal/generator/ecc/template/point.go.tmpl index fef054f5a1..e54abcd566 100644 --- a/internal/generator/ecc/template/point.go.tmpl +++ b/internal/generator/ecc/template/point.go.tmpl @@ -362,7 +362,7 @@ func (p *{{ $TJacobian }}) String() string { return _p.String() } -// FromAffine sets p = Q, p in Jacboian, Q in affine +// FromAffine sets p = Q, p in Jacobian, Q in affine func (p *{{ $TJacobian }}) FromAffine(Q *{{ $TAffine }}) *{{ $TJacobian }} { if Q.IsInfinity() { p.Z.SetZero() diff --git a/internal/generator/tower/asm/amd64/e2_bls381.go b/internal/generator/tower/asm/amd64/e2_bls381.go index 57abf58a05..d67663746e 100644 --- a/internal/generator/tower/asm/amd64/e2_bls381.go +++ b/internal/generator/tower/asm/amd64/e2_bls381.go @@ -56,7 +56,7 @@ func (fq2 *Fq2Amd64) generateMulByNonResidueE2BLS381() { func (fq2 *Fq2Amd64) generateSquareE2BLS381(forceCheck bool) { // // Square sets z to the E2-product of x,x returns z // func (z *E2) Square(x *E2) *E2 { - // // algo 22 https://eprint.iacr.org/2010/354.pdf + // // adapted from algo 22 https://eprint.iacr.org/2010/354.pdf // var a, b fp.Element // a.Add(&x.A0, &x.A1) // b.Sub(&x.A0, &x.A1) diff --git a/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl b/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl index d7bb6a26ab..cfa3508a0f 100644 --- a/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl +++ b/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl @@ -444,7 +444,7 @@ func (z *E12) Exp(x E12, k *big.Int) *E12 { e := k if k.Sign() == -1 { // negative k, we invert - // if k < 0: xᵏ (mod q) == (x⁻¹)ᵏ (mod q) + // if k < 0: xᵏ (mod q¹²) == (x⁻¹)ᵏ (mod q¹²) x.Inverse(&x) // we negate k in a temp big.Int since