diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 06d34a0c9d..9267b9ffba 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -38,7 +38,7 @@ jobs: go generate ./... git update-index --assume-unchanged go.mod git update-index --assume-unchanged go.sum - if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after runing go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi + if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after running go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi test: strategy: diff --git a/CHANGELOG.md b/CHANGELOG.md index a142c31e13..d7fd888855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,8 +24,8 @@ The scope of the audit covered `bn254` and `bls12-381` packages (including field ### Perf -- remove unecessary inverse in KZG-verify -- faster GLV scalar decompostion +- remove unnecessary inverse in KZG-verify +- faster GLV scalar decomposition ### Refactor & Docs @@ -34,7 +34,7 @@ The scope of the audit covered `bn254` and `bls12-381` packages (including field - remove dead code ([#230](https://github.com/ConsenSys/gnark-crypto/issues/230)) - cosmetic changes ([#197](https://github.com/ConsenSys/gnark-crypto/issues/197)) - replace modulus generated by constants, add zero-alloc SetRandom ([#194](https://github.com/ConsenSys/gnark-crypto/issues/194)) -- remove uneeded x86 asm and files ([#192](https://github.com/ConsenSys/gnark-crypto/issues/192)) +- remove unneeded x86 asm and files ([#192](https://github.com/ConsenSys/gnark-crypto/issues/192)) - polish readme.md with updated godoc subpackage links ([#235](https://github.com/ConsenSys/gnark-crypto/issues/235)) - acknowledge that inv(0)==0 in comments as a convention ([#233](https://github.com/ConsenSys/gnark-crypto/issues/233)) - added note in pairing godoc - doesn't check inputs are in correct subgroup ([#231](https://github.com/ConsenSys/gnark-crypto/issues/231)) @@ -137,7 +137,7 @@ The scope of the audit covered `bn254` and `bls12-381` packages (including field - **field:** added UnmarshalJSON and MarshalJSON on fields - **field:** added field.Text(base) to return field element string in a given base, like big.Int - **field:** field.SetString now supports 0b 0o 0x prefixes (base 2, 8 and 16) -- **kzg:** test tampered proofs whith quotient set to zero +- **kzg:** test tampered proofs with quotient set to zero - **bls24:** Fp-Fp2-Fp4-Fp12-Fp24 tower ### Fix @@ -265,9 +265,9 @@ The scope of the audit covered `bn254` and `bls12-381` packages (including field - ecc encoder now handles []Element so gnark don't have to - ecc encoders uses binary.Write and binary.Read to support basic types - added ecc.Implemented() that returns list of curve fully implemented -- added Reference bencharks for continuous benchmarking. fixes [#54](https://github.com/ConsenSys/gnark-crypto/issues/54) +- added Reference benchmarks for continuous benchmarking. fixes [#54](https://github.com/ConsenSys/gnark-crypto/issues/54) - added curve level go-fuzz fuzz functions -- **all curves:** faster GT memebership +- **all curves:** faster GT membership - **twisted Edwards:** tests use gopter, no more hardcoded values - **bls12-377:** change G2 generator (+Fp QNR) to match other libs - **bls12-377:** change G1 generator to match other libs @@ -294,7 +294,7 @@ The scope of the audit covered `bn254` and `bls12-381` packages (including field - **bw6:** new optimized final exp (hard part) - **bw6-633:** divide G1 cofactor formula by 4 - **bw6-633:** optimized hard part in final exp -- **fft:** introduced flatten kernel for n==8 and asm impl for butterfly to minimze memory writes +- **fft:** introduced flatten kernel for n==8 and asm impl for butterfly to minimize memory writes ### Refactor @@ -344,7 +344,7 @@ The scope of the audit covered `bn254` and `bls12-381` packages (including field - handle case where numCPU < 4 in precomputeExpTable - incorrect comment and size returned in twistededwards SetBytes fixes [#34](https://github.com/ConsenSys/gnark-crypto/issues/34) -- point.SetBytes can now be called concurently with same byte slice input +- point.SetBytes can now be called concurrently with same byte slice input diff --git a/ecc/bls12-377/fp/element.go b/ecc/bls12-377/fp/element.go index 1080d80b33..c0a01bd34b 100644 --- a/ecc/bls12-377/fp/element.go +++ b/ecc/bls12-377/fp/element.go @@ -356,7 +356,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bls12-377/fr/kzg/kzg_test.go b/ecc/bls12-377/fr/kzg/kzg_test.go index 15fd138c8c..d034ac1094 100644 --- a/ecc/bls12-377/fr/kzg/kzg_test.go +++ b/ecc/bls12-377/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bls12-377/fr/plookup/vector.go b/ecc/bls12-377/fr/plookup/vector.go index 9633f589b8..8273c663db 100644 --- a/ecc/bls12-377/fr/plookup/vector.go +++ b/ecc/bls12-377/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bls12-377/fr/polynomial/polynomial_test.go b/ecc/bls12-377/fr/polynomial/polynomial_test.go index eab8d3797a..81843e7f36 100644 --- a/ecc/bls12-377/fr/polynomial/polynomial_test.go +++ b/ecc/bls12-377/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bls12-377/fr/polynomial/pool.go b/ecc/bls12-377/fr/polynomial/pool.go index ba9e8ae9a0..4546674625 100644 --- a/ecc/bls12-377/fr/polynomial/pool.go +++ b/ecc/bls12-377/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bls12-377/g1.go b/ecc/bls12-377/g1.go index 54b5902349..0cf4a7df29 100644 --- a/ecc/bls12-377/g1.go +++ b/ecc/bls12-377/g1.go @@ -1027,7 +1027,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bls12-377/g2.go b/ecc/bls12-377/g2.go index bb8e3e5a61..a372a3ceb4 100644 --- a/ecc/bls12-377/g2.go +++ b/ecc/bls12-377/g2.go @@ -944,7 +944,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bls12-377/internal/fptower/e12.go b/ecc/bls12-377/internal/fptower/e12.go index 0d5d2b5532..956d6cace5 100644 --- a/ecc/bls12-377/internal/fptower/e12.go +++ b/ecc/bls12-377/internal/fptower/e12.go @@ -36,7 +36,7 @@ type E12 struct { C0, C1 E6 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) } @@ -99,7 +99,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } @@ -650,7 +650,7 @@ func (z *E12) Marshal() []byte { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E12) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -723,7 +723,7 @@ func (z *E12) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E12 is in correct sugroup +// IsInSubGroup ensures GT/E12 is in correct subgroup func (z *E12) IsInSubGroup() bool { var a, b E12 diff --git a/ecc/bls12-377/internal/fptower/e2.go b/ecc/bls12-377/internal/fptower/e2.go index 640fd52094..227570dc53 100644 --- a/ecc/bls12-377/internal/fptower/e2.go +++ b/ecc/bls12-377/internal/fptower/e2.go @@ -203,7 +203,7 @@ func (z *E2) Exp(x E2, k *big.Int) *E2 { } // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 10) diff --git a/ecc/bls12-377/internal/fptower/e6.go b/ecc/bls12-377/internal/fptower/e6.go index d4f80de958..90aba83b22 100644 --- a/ecc/bls12-377/internal/fptower/e6.go +++ b/ecc/bls12-377/internal/fptower/e6.go @@ -21,7 +21,7 @@ type E6 struct { B0, B1, B2 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) && z.B2.Equal(&x.B2) } diff --git a/ecc/bls12-377/multiexp.go b/ecc/bls12-377/multiexp.go index f75f78aa0a..cb727fa245 100644 --- a/ecc/bls12-377/multiexp.go +++ b/ecc/bls12-377/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -302,7 +302,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -312,7 +312,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -322,7 +322,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -364,7 +364,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -552,13 +552,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -577,7 +577,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -634,7 +634,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bls12-377/multiexp_affine.go b/ecc/bls12-377/multiexp_affine.go index 5aa3546b5e..31fb863840 100644 --- a/ecc/bls12-377/multiexp_affine.go +++ b/ecc/bls12-377/multiexp_affine.go @@ -47,7 +47,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -363,7 +363,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bls12-377/multiexp_jacobian.go b/ecc/bls12-377/multiexp_jacobian.go index e01f5567f5..1a24aa25b0 100644 --- a/ecc/bls12-377/multiexp_jacobian.go +++ b/ecc/bls12-377/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -110,7 +110,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bls12-377/multiexp_test.go b/ecc/bls12-377/multiexp_test.go index 4b2373bc27..f07f32dd16 100644 --- a/ecc/bls12-377/multiexp_test.go +++ b/ecc/bls12-377/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bls12-377/twistededwards/eddsa/eddsa_test.go b/ecc/bls12-377/twistededwards/eddsa/eddsa_test.go index 1175d7458a..2c2148143a 100644 --- a/ecc/bls12-377/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bls12-377/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bls12-377/twistededwards/eddsa/marshal.go b/ecc/bls12-377/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bls12-377/twistededwards/eddsa/marshal.go +++ b/ecc/bls12-377/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bls12-378/fp/element.go b/ecc/bls12-378/fp/element.go index 51105fe164..cf7a8a852d 100644 --- a/ecc/bls12-378/fp/element.go +++ b/ecc/bls12-378/fp/element.go @@ -356,7 +356,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bls12-378/fr/kzg/kzg_test.go b/ecc/bls12-378/fr/kzg/kzg_test.go index ac34313269..df9e08abb0 100644 --- a/ecc/bls12-378/fr/kzg/kzg_test.go +++ b/ecc/bls12-378/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bls12-378/fr/plookup/vector.go b/ecc/bls12-378/fr/plookup/vector.go index 67384cf7be..edc0adfee5 100644 --- a/ecc/bls12-378/fr/plookup/vector.go +++ b/ecc/bls12-378/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bls12-378/fr/polynomial/polynomial_test.go b/ecc/bls12-378/fr/polynomial/polynomial_test.go index 7cf5ee4798..effa4af1b6 100644 --- a/ecc/bls12-378/fr/polynomial/polynomial_test.go +++ b/ecc/bls12-378/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bls12-378/fr/polynomial/pool.go b/ecc/bls12-378/fr/polynomial/pool.go index 62e0dbded6..e7c2ae68b1 100644 --- a/ecc/bls12-378/fr/polynomial/pool.go +++ b/ecc/bls12-378/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bls12-378/g1.go b/ecc/bls12-378/g1.go index 1c246ca4b9..9c47102f07 100644 --- a/ecc/bls12-378/g1.go +++ b/ecc/bls12-378/g1.go @@ -1027,7 +1027,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bls12-378/g2.go b/ecc/bls12-378/g2.go index 61b0f209e2..53f44e24e4 100644 --- a/ecc/bls12-378/g2.go +++ b/ecc/bls12-378/g2.go @@ -944,7 +944,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bls12-378/internal/fptower/e12.go b/ecc/bls12-378/internal/fptower/e12.go index 431228a081..91a5d375db 100644 --- a/ecc/bls12-378/internal/fptower/e12.go +++ b/ecc/bls12-378/internal/fptower/e12.go @@ -36,7 +36,7 @@ type E12 struct { C0, C1 E6 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) } @@ -99,7 +99,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } @@ -650,7 +650,7 @@ func (z *E12) Marshal() []byte { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E12) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -723,7 +723,7 @@ func (z *E12) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E12 is in correct sugroup +// IsInSubGroup ensures GT/E12 is in correct subgroup func (z *E12) IsInSubGroup() bool { var a, b E12 diff --git a/ecc/bls12-378/internal/fptower/e2.go b/ecc/bls12-378/internal/fptower/e2.go index 0279a9d66b..e947085854 100644 --- a/ecc/bls12-378/internal/fptower/e2.go +++ b/ecc/bls12-378/internal/fptower/e2.go @@ -203,7 +203,7 @@ func (z *E2) Exp(x E2, k *big.Int) *E2 { } // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 10) diff --git a/ecc/bls12-378/internal/fptower/e6.go b/ecc/bls12-378/internal/fptower/e6.go index d4f80de958..90aba83b22 100644 --- a/ecc/bls12-378/internal/fptower/e6.go +++ b/ecc/bls12-378/internal/fptower/e6.go @@ -21,7 +21,7 @@ type E6 struct { B0, B1, B2 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) && z.B2.Equal(&x.B2) } diff --git a/ecc/bls12-378/multiexp.go b/ecc/bls12-378/multiexp.go index 48e136e41d..30594aeb23 100644 --- a/ecc/bls12-378/multiexp.go +++ b/ecc/bls12-378/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -304,7 +304,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -314,7 +314,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -324,7 +324,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -366,7 +366,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -556,13 +556,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -581,7 +581,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -638,7 +638,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bls12-378/multiexp_affine.go b/ecc/bls12-378/multiexp_affine.go index 28301102cf..fe7f2d6283 100644 --- a/ecc/bls12-378/multiexp_affine.go +++ b/ecc/bls12-378/multiexp_affine.go @@ -47,7 +47,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -363,7 +363,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bls12-378/multiexp_jacobian.go b/ecc/bls12-378/multiexp_jacobian.go index 0e9d572e73..7ebc069210 100644 --- a/ecc/bls12-378/multiexp_jacobian.go +++ b/ecc/bls12-378/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -112,7 +112,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bls12-378/multiexp_test.go b/ecc/bls12-378/multiexp_test.go index dea9f4bbda..bffa3a5d19 100644 --- a/ecc/bls12-378/multiexp_test.go +++ b/ecc/bls12-378/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bls12-378/twistededwards/eddsa/eddsa_test.go b/ecc/bls12-378/twistededwards/eddsa/eddsa_test.go index f7e0956696..14ebba1f1c 100644 --- a/ecc/bls12-378/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bls12-378/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bls12-378/twistededwards/eddsa/marshal.go b/ecc/bls12-378/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bls12-378/twistededwards/eddsa/marshal.go +++ b/ecc/bls12-378/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bls12-381/bandersnatch/eddsa/eddsa_test.go b/ecc/bls12-381/bandersnatch/eddsa/eddsa_test.go index 85bd27ca02..890b0980be 100644 --- a/ecc/bls12-381/bandersnatch/eddsa/eddsa_test.go +++ b/ecc/bls12-381/bandersnatch/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bls12-381/bandersnatch/eddsa/marshal.go b/ecc/bls12-381/bandersnatch/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bls12-381/bandersnatch/eddsa/marshal.go +++ b/ecc/bls12-381/bandersnatch/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bls12-381/fp/element.go b/ecc/bls12-381/fp/element.go index 0cc4fe61f7..df66624b09 100644 --- a/ecc/bls12-381/fp/element.go +++ b/ecc/bls12-381/fp/element.go @@ -356,7 +356,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bls12-381/fr/kzg/kzg_test.go b/ecc/bls12-381/fr/kzg/kzg_test.go index eb72cadb34..9b30bb591a 100644 --- a/ecc/bls12-381/fr/kzg/kzg_test.go +++ b/ecc/bls12-381/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bls12-381/fr/plookup/vector.go b/ecc/bls12-381/fr/plookup/vector.go index 0bcc487692..7d2e6251b1 100644 --- a/ecc/bls12-381/fr/plookup/vector.go +++ b/ecc/bls12-381/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bls12-381/fr/polynomial/polynomial_test.go b/ecc/bls12-381/fr/polynomial/polynomial_test.go index 5df4aebaea..27f4a2f048 100644 --- a/ecc/bls12-381/fr/polynomial/polynomial_test.go +++ b/ecc/bls12-381/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bls12-381/fr/polynomial/pool.go b/ecc/bls12-381/fr/polynomial/pool.go index c50331e19f..d28ad93077 100644 --- a/ecc/bls12-381/fr/polynomial/pool.go +++ b/ecc/bls12-381/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bls12-381/g1.go b/ecc/bls12-381/g1.go index fdedb8aa8e..33538de791 100644 --- a/ecc/bls12-381/g1.go +++ b/ecc/bls12-381/g1.go @@ -1027,7 +1027,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bls12-381/g2.go b/ecc/bls12-381/g2.go index f54168f46f..7cb3b0926c 100644 --- a/ecc/bls12-381/g2.go +++ b/ecc/bls12-381/g2.go @@ -945,7 +945,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bls12-381/internal/fptower/e12.go b/ecc/bls12-381/internal/fptower/e12.go index bc6391723d..b9f93b6b08 100644 --- a/ecc/bls12-381/internal/fptower/e12.go +++ b/ecc/bls12-381/internal/fptower/e12.go @@ -36,7 +36,7 @@ type E12 struct { C0, C1 E6 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) } @@ -99,7 +99,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } @@ -650,7 +650,7 @@ func (z *E12) Marshal() []byte { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E12) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -723,7 +723,7 @@ func (z *E12) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E12 is in correct sugroup +// IsInSubGroup ensures GT/E12 is in correct subgroup func (z *E12) IsInSubGroup() bool { var a, b E12 diff --git a/ecc/bls12-381/internal/fptower/e2.go b/ecc/bls12-381/internal/fptower/e2.go index 45338f1896..6c873ce365 100644 --- a/ecc/bls12-381/internal/fptower/e2.go +++ b/ecc/bls12-381/internal/fptower/e2.go @@ -214,7 +214,7 @@ func init() { var sqrtExp1, sqrtExp2 big.Int // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 9) diff --git a/ecc/bls12-381/internal/fptower/e6.go b/ecc/bls12-381/internal/fptower/e6.go index d4f80de958..90aba83b22 100644 --- a/ecc/bls12-381/internal/fptower/e6.go +++ b/ecc/bls12-381/internal/fptower/e6.go @@ -21,7 +21,7 @@ type E6 struct { B0, B1, B2 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) && z.B2.Equal(&x.B2) } diff --git a/ecc/bls12-381/multiexp.go b/ecc/bls12-381/multiexp.go index 68e8b38eaa..8462d8abe1 100644 --- a/ecc/bls12-381/multiexp.go +++ b/ecc/bls12-381/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -302,7 +302,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -312,7 +312,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -322,7 +322,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -364,7 +364,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -552,13 +552,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -577,7 +577,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -634,7 +634,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bls12-381/multiexp_affine.go b/ecc/bls12-381/multiexp_affine.go index f2fcc05732..799457d182 100644 --- a/ecc/bls12-381/multiexp_affine.go +++ b/ecc/bls12-381/multiexp_affine.go @@ -47,7 +47,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -363,7 +363,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bls12-381/multiexp_jacobian.go b/ecc/bls12-381/multiexp_jacobian.go index 2a2f8caa85..169f320342 100644 --- a/ecc/bls12-381/multiexp_jacobian.go +++ b/ecc/bls12-381/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -110,7 +110,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bls12-381/multiexp_test.go b/ecc/bls12-381/multiexp_test.go index 37893d7b1e..64b5a03480 100644 --- a/ecc/bls12-381/multiexp_test.go +++ b/ecc/bls12-381/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bls12-381/twistededwards/eddsa/eddsa_test.go b/ecc/bls12-381/twistededwards/eddsa/eddsa_test.go index 85bd27ca02..890b0980be 100644 --- a/ecc/bls12-381/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bls12-381/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bls12-381/twistededwards/eddsa/marshal.go b/ecc/bls12-381/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bls12-381/twistededwards/eddsa/marshal.go +++ b/ecc/bls12-381/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bls24-315/fp/element.go b/ecc/bls24-315/fp/element.go index 234f87bb42..4bb276b667 100644 --- a/ecc/bls24-315/fp/element.go +++ b/ecc/bls24-315/fp/element.go @@ -345,7 +345,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bls24-315/fr/kzg/kzg_test.go b/ecc/bls24-315/fr/kzg/kzg_test.go index 31183a6188..8177038c5b 100644 --- a/ecc/bls24-315/fr/kzg/kzg_test.go +++ b/ecc/bls24-315/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bls24-315/fr/plookup/vector.go b/ecc/bls24-315/fr/plookup/vector.go index b88c6d5a60..7fda13b9ce 100644 --- a/ecc/bls24-315/fr/plookup/vector.go +++ b/ecc/bls24-315/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bls24-315/fr/polynomial/polynomial_test.go b/ecc/bls24-315/fr/polynomial/polynomial_test.go index ad1f480f0d..b71f200939 100644 --- a/ecc/bls24-315/fr/polynomial/polynomial_test.go +++ b/ecc/bls24-315/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bls24-315/fr/polynomial/pool.go b/ecc/bls24-315/fr/polynomial/pool.go index a0ddf7c152..c22ebc83b0 100644 --- a/ecc/bls24-315/fr/polynomial/pool.go +++ b/ecc/bls24-315/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bls24-315/g1.go b/ecc/bls24-315/g1.go index 59e1e91ed3..83426d4e99 100644 --- a/ecc/bls24-315/g1.go +++ b/ecc/bls24-315/g1.go @@ -1029,7 +1029,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bls24-315/g2.go b/ecc/bls24-315/g2.go index 89d1555ab5..d73145d73f 100644 --- a/ecc/bls24-315/g2.go +++ b/ecc/bls24-315/g2.go @@ -960,7 +960,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bls24-315/internal/fptower/e12.go b/ecc/bls24-315/internal/fptower/e12.go index 0bc4d0b283..f2c3922011 100644 --- a/ecc/bls24-315/internal/fptower/e12.go +++ b/ecc/bls24-315/internal/fptower/e12.go @@ -23,7 +23,7 @@ type E12 struct { C0, C1, C2 E4 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) && z.C2.Equal(&x.C2) } @@ -70,7 +70,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() && z.C2.IsZero() } diff --git a/ecc/bls24-315/internal/fptower/e2.go b/ecc/bls24-315/internal/fptower/e2.go index 73cf362647..a23c0ebb99 100644 --- a/ecc/bls24-315/internal/fptower/e2.go +++ b/ecc/bls24-315/internal/fptower/e2.go @@ -187,7 +187,7 @@ func (z *E2) Exp(x E2, k *big.Int) *E2 { } // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 10) diff --git a/ecc/bls24-315/internal/fptower/e24.go b/ecc/bls24-315/internal/fptower/e24.go index 053e329dab..5a7af0fdf4 100644 --- a/ecc/bls24-315/internal/fptower/e24.go +++ b/ecc/bls24-315/internal/fptower/e24.go @@ -34,7 +34,7 @@ type E24 struct { D0, D1 E12 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E24) Equal(x *E24) bool { return z.D0.Equal(&x.D0) && z.D1.Equal(&x.D1) } @@ -97,7 +97,7 @@ func (z *E24) SetRandom() (*E24, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E24) IsZero() bool { return z.D0.IsZero() && z.D1.IsZero() } @@ -640,7 +640,7 @@ func (z *E24) Marshal() []byte { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E24) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -806,7 +806,7 @@ func (z *E24) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E24 is in correct sugroup +// IsInSubGroup ensures GT/E24 is in correct subgroup func (z *E24) IsInSubGroup() bool { var a, b E24 diff --git a/ecc/bls24-315/internal/fptower/e4.go b/ecc/bls24-315/internal/fptower/e4.go index a77125da63..204cf5bd3e 100644 --- a/ecc/bls24-315/internal/fptower/e4.go +++ b/ecc/bls24-315/internal/fptower/e4.go @@ -25,7 +25,7 @@ type E4 struct { B0, B1 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E4) Equal(x *E4) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) } @@ -133,7 +133,7 @@ func (z *E4) SetRandom() (*E4, error) { return z, nil } -// IsZero returns true if the element is zero, fasle otherwise +// IsZero returns true if the element is zero, false otherwise func (z *E4) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() } @@ -270,7 +270,7 @@ func (z *E4) Legendre() int { } // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 10) diff --git a/ecc/bls24-315/multiexp.go b/ecc/bls24-315/multiexp.go index 52abe34e07..a705a1e109 100644 --- a/ecc/bls24-315/multiexp.go +++ b/ecc/bls24-315/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -302,7 +302,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -312,7 +312,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -322,7 +322,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -364,7 +364,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -552,13 +552,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -577,7 +577,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -634,7 +634,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bls24-315/multiexp_affine.go b/ecc/bls24-315/multiexp_affine.go index 40a45408fe..7bfb333514 100644 --- a/ecc/bls24-315/multiexp_affine.go +++ b/ecc/bls24-315/multiexp_affine.go @@ -47,7 +47,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -363,7 +363,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bls24-315/multiexp_jacobian.go b/ecc/bls24-315/multiexp_jacobian.go index be0bb121b4..e7636a28d1 100644 --- a/ecc/bls24-315/multiexp_jacobian.go +++ b/ecc/bls24-315/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -110,7 +110,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bls24-315/multiexp_test.go b/ecc/bls24-315/multiexp_test.go index e8e61b0492..b4f5e17dbf 100644 --- a/ecc/bls24-315/multiexp_test.go +++ b/ecc/bls24-315/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bls24-315/twistededwards/eddsa/eddsa_test.go b/ecc/bls24-315/twistededwards/eddsa/eddsa_test.go index 669bce5e65..2ca085f9cd 100644 --- a/ecc/bls24-315/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bls24-315/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bls24-315/twistededwards/eddsa/marshal.go b/ecc/bls24-315/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bls24-315/twistededwards/eddsa/marshal.go +++ b/ecc/bls24-315/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bls24-317/fp/element.go b/ecc/bls24-317/fp/element.go index 89cafe1a22..9e2d025dbb 100644 --- a/ecc/bls24-317/fp/element.go +++ b/ecc/bls24-317/fp/element.go @@ -345,7 +345,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bls24-317/fr/kzg/kzg_test.go b/ecc/bls24-317/fr/kzg/kzg_test.go index 079aa49ee8..c01df91531 100644 --- a/ecc/bls24-317/fr/kzg/kzg_test.go +++ b/ecc/bls24-317/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bls24-317/fr/plookup/vector.go b/ecc/bls24-317/fr/plookup/vector.go index b3ef82389a..169ee7ccdd 100644 --- a/ecc/bls24-317/fr/plookup/vector.go +++ b/ecc/bls24-317/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bls24-317/fr/polynomial/polynomial_test.go b/ecc/bls24-317/fr/polynomial/polynomial_test.go index 25d87b841b..024f71a3fa 100644 --- a/ecc/bls24-317/fr/polynomial/polynomial_test.go +++ b/ecc/bls24-317/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bls24-317/fr/polynomial/pool.go b/ecc/bls24-317/fr/polynomial/pool.go index 2ab5c7979a..8dc834b2e7 100644 --- a/ecc/bls24-317/fr/polynomial/pool.go +++ b/ecc/bls24-317/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bls24-317/g1.go b/ecc/bls24-317/g1.go index 9827f258fe..36bb6c6adb 100644 --- a/ecc/bls24-317/g1.go +++ b/ecc/bls24-317/g1.go @@ -1029,7 +1029,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bls24-317/g2.go b/ecc/bls24-317/g2.go index 52d088f197..ef831f154b 100644 --- a/ecc/bls24-317/g2.go +++ b/ecc/bls24-317/g2.go @@ -960,7 +960,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bls24-317/internal/fptower/e12.go b/ecc/bls24-317/internal/fptower/e12.go index 9f41f03a39..5d33f44aa6 100644 --- a/ecc/bls24-317/internal/fptower/e12.go +++ b/ecc/bls24-317/internal/fptower/e12.go @@ -23,7 +23,7 @@ type E12 struct { C0, C1, C2 E4 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) && z.C2.Equal(&x.C2) } @@ -70,7 +70,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() && z.C2.IsZero() } diff --git a/ecc/bls24-317/internal/fptower/e2.go b/ecc/bls24-317/internal/fptower/e2.go index c8091c6f92..e88426e598 100644 --- a/ecc/bls24-317/internal/fptower/e2.go +++ b/ecc/bls24-317/internal/fptower/e2.go @@ -198,7 +198,7 @@ func init() { var sqrtExp1, sqrtExp2 big.Int // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 9) diff --git a/ecc/bls24-317/internal/fptower/e24.go b/ecc/bls24-317/internal/fptower/e24.go index dc9dc25b62..85af0a8cd1 100644 --- a/ecc/bls24-317/internal/fptower/e24.go +++ b/ecc/bls24-317/internal/fptower/e24.go @@ -34,7 +34,7 @@ type E24 struct { D0, D1 E12 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E24) Equal(x *E24) bool { return z.D0.Equal(&x.D0) && z.D1.Equal(&x.D1) } @@ -97,7 +97,7 @@ func (z *E24) SetRandom() (*E24, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E24) IsZero() bool { return z.D0.IsZero() && z.D1.IsZero() } @@ -562,7 +562,7 @@ func (z *E24) Marshal() []byte { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E24) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -728,7 +728,7 @@ func (z *E24) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E24 is in correct sugroup +// IsInSubGroup ensures GT/E24 is in correct subgroup func (z *E24) IsInSubGroup() bool { var a, b E24 diff --git a/ecc/bls24-317/internal/fptower/e4.go b/ecc/bls24-317/internal/fptower/e4.go index 71e514882d..3569253c71 100644 --- a/ecc/bls24-317/internal/fptower/e4.go +++ b/ecc/bls24-317/internal/fptower/e4.go @@ -25,7 +25,7 @@ type E4 struct { B0, B1 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E4) Equal(x *E4) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) } @@ -133,7 +133,7 @@ func (z *E4) SetRandom() (*E4, error) { return z, nil } -// IsZero returns true if the element is zero, fasle otherwise +// IsZero returns true if the element is zero, false otherwise func (z *E4) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() } @@ -271,7 +271,7 @@ func (z *E4) Legendre() int { } // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 10) diff --git a/ecc/bls24-317/multiexp.go b/ecc/bls24-317/multiexp.go index 037aa65388..db30c174d4 100644 --- a/ecc/bls24-317/multiexp.go +++ b/ecc/bls24-317/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -302,7 +302,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -312,7 +312,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -322,7 +322,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -364,7 +364,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -552,13 +552,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -577,7 +577,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -634,7 +634,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bls24-317/multiexp_affine.go b/ecc/bls24-317/multiexp_affine.go index 803835d815..afe3e43ab9 100644 --- a/ecc/bls24-317/multiexp_affine.go +++ b/ecc/bls24-317/multiexp_affine.go @@ -47,7 +47,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -363,7 +363,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bls24-317/multiexp_jacobian.go b/ecc/bls24-317/multiexp_jacobian.go index 15fbf46f0e..eb284f3bc2 100644 --- a/ecc/bls24-317/multiexp_jacobian.go +++ b/ecc/bls24-317/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -110,7 +110,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bls24-317/multiexp_test.go b/ecc/bls24-317/multiexp_test.go index ec6b082651..44196e0c0f 100644 --- a/ecc/bls24-317/multiexp_test.go +++ b/ecc/bls24-317/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bls24-317/twistededwards/eddsa/eddsa_test.go b/ecc/bls24-317/twistededwards/eddsa/eddsa_test.go index 34464874cd..b480a83fee 100644 --- a/ecc/bls24-317/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bls24-317/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bls24-317/twistededwards/eddsa/marshal.go b/ecc/bls24-317/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bls24-317/twistededwards/eddsa/marshal.go +++ b/ecc/bls24-317/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bn254/fp/element.go b/ecc/bn254/fp/element.go index 5671c99003..e601c0ffad 100644 --- a/ecc/bn254/fp/element.go +++ b/ecc/bn254/fp/element.go @@ -334,7 +334,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bn254/fr/kzg/kzg_test.go b/ecc/bn254/fr/kzg/kzg_test.go index e571341aef..0cdd9c24b0 100644 --- a/ecc/bn254/fr/kzg/kzg_test.go +++ b/ecc/bn254/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bn254/fr/plookup/vector.go b/ecc/bn254/fr/plookup/vector.go index 30179a31de..8094072c7d 100644 --- a/ecc/bn254/fr/plookup/vector.go +++ b/ecc/bn254/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bn254/fr/polynomial/polynomial_test.go b/ecc/bn254/fr/polynomial/polynomial_test.go index a97c4df620..173af697ca 100644 --- a/ecc/bn254/fr/polynomial/polynomial_test.go +++ b/ecc/bn254/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bn254/fr/polynomial/pool.go b/ecc/bn254/fr/polynomial/pool.go index de0b42983f..67881d1f6c 100644 --- a/ecc/bn254/fr/polynomial/pool.go +++ b/ecc/bn254/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bn254/fr/sis/sis.go b/ecc/bn254/fr/sis/sis.go index 411db7887b..494bdef35c 100644 --- a/ecc/bn254/fr/sis/sis.go +++ b/ecc/bn254/fr/sis/sis.go @@ -45,7 +45,7 @@ type RSis struct { A [][]fr.Element Ag [][]fr.Element - // LogTwoBound (Inifinty norm) of the vector to hash. It means that each component in m + // LogTwoBound (Infinity norm) of the vector to hash. It means that each component in m // is < 2^B, where m is the vector to hash (the hash being A*m). // cf https://hackmd.io/7OODKWQZRRW9RxM5BaXtIw , B >= 3. LogTwoBound int @@ -146,7 +146,7 @@ func NewRSis(seed int64, logTwoDegree, logTwoBound, maxNbElementsToHash int) (*R r.Domain.FFT(r.Ag[i], fft.DIF, fft.OnCoset()) } }) - // TODO @gbotrel add nbtasks here; whiile in tests it's more convenient to paralellize + // TODO @gbotrel add nbtasks here; while in tests it's more convenient to parallelize // in tensor-commitment we may not want to do that. return r, nil @@ -253,7 +253,7 @@ func genRandom(seed, i, j int64, buf *bytes.Buffer) fr.Element { } // mulMod computes p * q in ℤ_{p}[X]/Xᵈ+1. -// Is assumed that pLagrangeShifted and qLagrangeShifted are of the corret sizes +// Is assumed that pLagrangeShifted and qLagrangeShifted are of the correct sizes // and that they are in evaluation form on √(g) * // The result is not FFTinversed. The fft inverse is done once every // multiplications are done. @@ -303,7 +303,7 @@ func (r *RSis) cleanupBuffers() { // Split an slice of bytes representing an array of serialized field element in // big-endian form into an array of limbs representing the same field elements -// in little-endian form. Namely, if our field is reprented with 64 bits and we +// in little-endian form. Namely, if our field is represented with 64 bits and we // have the following field element 0x0123456789abcdef (0 being the most significant // character and and f being the least significant one) and our log norm bound is // 16 (so 1 hex character = 1 limb). The function assigns the values of m to [f, e, @@ -316,7 +316,7 @@ func LimbDecomposeBytes(buf []byte, m fr.Vector, logTwoBound int) { // Split an slice of bytes representing an array of serialized field element in // big-endian form into an array of limbs representing the same field elements -// in little-endian form. Namely, if our field is reprented with 64 bits and we +// in little-endian form. Namely, if our field is represented with 64 bits and we // have the following field element 0x0123456789abcdef (0 being the most significant // character and and f being the least significant one) and our log norm bound is // 16 (so 1 hex character = 1 limb). The function assigns the values of m to [f, e, diff --git a/ecc/bn254/fr/sis/sis_test.go b/ecc/bn254/fr/sis/sis_test.go index 6a9432d4eb..6925c7c9ec 100644 --- a/ecc/bn254/fr/sis/sis_test.go +++ b/ecc/bn254/fr/sis/sis_test.go @@ -75,7 +75,7 @@ func TestReference(t *testing.T) { assert.NoError(err) // key generation same than in sage - makeKeyDeterminitic(t, sis, testCase.Params.Seed) + makeKeyDeterministic(t, sis, testCase.Params.Seed) for i, in := range testCases.Inputs { sis.Reset() @@ -99,7 +99,7 @@ func TestReference(t *testing.T) { if len(in) < testCase.Params.MaxNbElementsToHash { sis2, err := NewRSis(testCase.Params.Seed, testCase.Params.LogTwoDegree, testCase.Params.LogTwoBound, len(in)) assert.NoError(err) - makeKeyDeterminitic(t, sis2, testCase.Params.Seed) + makeKeyDeterministic(t, sis2, testCase.Params.Seed) got2, err := sis2.Hash(in) assert.NoError(err) @@ -226,7 +226,7 @@ func TestLimbDecomposition(t *testing.T) { } } -func makeKeyDeterminitic(t *testing.T, sis *RSis, _seed int64) { +func makeKeyDeterministic(t *testing.T, sis *RSis, _seed int64) { t.Helper() // generate the key deterministically, the same way // we do in sage to generate the test vectors. @@ -307,7 +307,7 @@ func BenchmarkSIS(b *testing.B) { } } -func benchmarkSIS(b *testing.B, input []fr.Element, sparse bool, logTwoBound, logTwoDegree int, theoritical float64) { +func benchmarkSIS(b *testing.B, input []fr.Element, sparse bool, logTwoBound, logTwoDegree int, theoretical float64) { b.Helper() n := len(input) @@ -343,7 +343,7 @@ func benchmarkSIS(b *testing.B, input []fr.Element, sparse bool, logTwoBound, lo b.ReportMetric(float64(nsPerField), "ns/field") - b.ReportMetric(theoritical, "ns/field(theory)") + b.ReportMetric(theoretical, "ns/field(theory)") }) } diff --git a/ecc/bn254/fr/tensor-commitment/commitment.go b/ecc/bn254/fr/tensor-commitment/commitment.go index 20ce566a99..923cbef2af 100644 --- a/ecc/bn254/fr/tensor-commitment/commitment.go +++ b/ecc/bn254/fr/tensor-commitment/commitment.go @@ -104,14 +104,14 @@ type TensorCommitment struct { // same content as state, but the polynomials are displayed as a matrix // and the rows are encoded. // encodedState = encodeRows(M_0 || .. || M_n) - // where M_i is the i-th polynomial layed out as a matrix, that is + // where M_i is the i-th polynomial laid out as a matrix, that is // M_i_jk = p_i[i*m+j] where m = \sqrt(len(p)). EncodedState [][]fr.Element // boolean telling if the commitment has already been done. // The method BuildProof cannot be called before Commit(), // because it would allow to build a proof before giving the commitment - // to a verifier, making the worklow not secure. + // to a verifier, making the workflow not secure. isCommitted bool // number of columns which have already been hashed (atomic) @@ -121,7 +121,7 @@ type TensorCommitment struct { NbAppendsSoFar int } -// NewTensorCommitment retunrs a new TensorCommitment +// NewTensorCommitment returns a new TensorCommitment // * ρ rate of the code ( > 1) // * size size of the polynomial to be committed. The size of the commitment is // then ρ * √(m) where m² = size @@ -296,7 +296,7 @@ func (tc *TensorCommitment) Commit() (Digest, error) { } }) - // records that the ccommitment has been built + // records that the commitment has been built tc.isCommitted = true return res, nil diff --git a/ecc/bn254/fr/tensor-commitment/commitment_test.go b/ecc/bn254/fr/tensor-commitment/commitment_test.go index 19e7be893b..a970a2dee2 100644 --- a/ecc/bn254/fr/tensor-commitment/commitment_test.go +++ b/ecc/bn254/fr/tensor-commitment/commitment_test.go @@ -254,7 +254,7 @@ func TestCommitmentDummyHash(t *testing.T) { t.Fatal(err) } - // verfiy that the proof is correct + // verify that the proof is correct err = Verify(proof, digest, l, h) if err != nil { t.Fatal(err) @@ -316,7 +316,7 @@ func TestOpeningDummyHash(t *testing.T) { t.Fatal(err) } - // finish the evalutation by computing + // finish the evaluation by computing // [linearCombination] * [hi]^t var eval, tmp fr.Element for i := 0; i < nbColumns; i++ { @@ -456,7 +456,7 @@ func TestCommitmentSis(t *testing.T) { t.Fatal(err) } - // verfiy that the proof is correct + // verify that the proof is correct err = Verify(proof, digest, l, hMaker()) if err != nil { t.Fatal(err) @@ -475,7 +475,7 @@ func TestCommitmentSis(t *testing.T) { t.Fatal(err) } - // verfiy that the proof is correct + // verify that the proof is correct err = Verify(proof, digest, l, hMaker()) if err != nil { t.Fatal(err) diff --git a/ecc/bn254/g1.go b/ecc/bn254/g1.go index b3d16cc60d..af6ce43d90 100644 --- a/ecc/bn254/g1.go +++ b/ecc/bn254/g1.go @@ -998,7 +998,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bn254/g2.go b/ecc/bn254/g2.go index da0b89b9c3..e87a8aef4c 100644 --- a/ecc/bn254/g2.go +++ b/ecc/bn254/g2.go @@ -949,7 +949,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bn254/internal/fptower/e12.go b/ecc/bn254/internal/fptower/e12.go index 35961e0095..6830ee1054 100644 --- a/ecc/bn254/internal/fptower/e12.go +++ b/ecc/bn254/internal/fptower/e12.go @@ -36,7 +36,7 @@ type E12 struct { C0, C1 E6 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) } @@ -99,7 +99,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } @@ -650,7 +650,7 @@ func (z *E12) Marshal() []byte { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E12) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -723,7 +723,7 @@ func (z *E12) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E12 is in correct sugroup +// IsInSubGroup ensures GT/E12 is in correct subgroup func (z *E12) IsInSubGroup() bool { var a, b, _b E12 diff --git a/ecc/bn254/internal/fptower/e2.go b/ecc/bn254/internal/fptower/e2.go index 65dda39924..1a954aa38d 100644 --- a/ecc/bn254/internal/fptower/e2.go +++ b/ecc/bn254/internal/fptower/e2.go @@ -214,7 +214,7 @@ func init() { var sqrtExp1, sqrtExp2 big.Int // Sqrt sets z to the square root of and returns z -// The function does not test wether the square root +// The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 9) diff --git a/ecc/bn254/internal/fptower/e6.go b/ecc/bn254/internal/fptower/e6.go index d4f80de958..90aba83b22 100644 --- a/ecc/bn254/internal/fptower/e6.go +++ b/ecc/bn254/internal/fptower/e6.go @@ -21,7 +21,7 @@ type E6 struct { B0, B1, B2 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) && z.B2.Equal(&x.B2) } diff --git a/ecc/bn254/multiexp.go b/ecc/bn254/multiexp.go index bb4a7d6e11..bca697954c 100644 --- a/ecc/bn254/multiexp.go +++ b/ecc/bn254/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -304,7 +304,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -314,7 +314,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -324,7 +324,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -366,7 +366,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -556,13 +556,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -581,7 +581,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -638,7 +638,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bn254/multiexp_affine.go b/ecc/bn254/multiexp_affine.go index c0fd33431e..b761c3bf47 100644 --- a/ecc/bn254/multiexp_affine.go +++ b/ecc/bn254/multiexp_affine.go @@ -47,7 +47,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -363,7 +363,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bn254/multiexp_jacobian.go b/ecc/bn254/multiexp_jacobian.go index 0bd2482a98..2a9c92a8d3 100644 --- a/ecc/bn254/multiexp_jacobian.go +++ b/ecc/bn254/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -112,7 +112,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bn254/multiexp_test.go b/ecc/bn254/multiexp_test.go index 0ea889322d..b0aca8e31d 100644 --- a/ecc/bn254/multiexp_test.go +++ b/ecc/bn254/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bn254/twistededwards/eddsa/eddsa_test.go b/ecc/bn254/twistededwards/eddsa/eddsa_test.go index 3bf8c9d989..eb23ddd966 100644 --- a/ecc/bn254/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bn254/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bn254/twistededwards/eddsa/marshal.go b/ecc/bn254/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bn254/twistededwards/eddsa/marshal.go +++ b/ecc/bn254/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bw6-633/fp/element.go b/ecc/bw6-633/fp/element.go index ee9f329c94..31cd9222e2 100644 --- a/ecc/bw6-633/fp/element.go +++ b/ecc/bw6-633/fp/element.go @@ -400,7 +400,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bw6-633/fr/kzg/kzg_test.go b/ecc/bw6-633/fr/kzg/kzg_test.go index 0d0ddedcb2..69e843175a 100644 --- a/ecc/bw6-633/fr/kzg/kzg_test.go +++ b/ecc/bw6-633/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bw6-633/fr/plookup/vector.go b/ecc/bw6-633/fr/plookup/vector.go index 06b5561919..588f51bfc9 100644 --- a/ecc/bw6-633/fr/plookup/vector.go +++ b/ecc/bw6-633/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bw6-633/fr/polynomial/polynomial_test.go b/ecc/bw6-633/fr/polynomial/polynomial_test.go index e91d99ac0a..f2316234d8 100644 --- a/ecc/bw6-633/fr/polynomial/polynomial_test.go +++ b/ecc/bw6-633/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bw6-633/fr/polynomial/pool.go b/ecc/bw6-633/fr/polynomial/pool.go index d16b377b70..a903db55c1 100644 --- a/ecc/bw6-633/fr/polynomial/pool.go +++ b/ecc/bw6-633/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bw6-633/g1.go b/ecc/bw6-633/g1.go index 65c7176f5c..2458b74307 100644 --- a/ecc/bw6-633/g1.go +++ b/ecc/bw6-633/g1.go @@ -1132,7 +1132,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bw6-633/g2.go b/ecc/bw6-633/g2.go index 66ff5c9989..6a44da4a03 100644 --- a/ecc/bw6-633/g2.go +++ b/ecc/bw6-633/g2.go @@ -916,7 +916,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bw6-633/internal/fptower/e3.go b/ecc/bw6-633/internal/fptower/e3.go index c46ce8b570..33c3b5a727 100644 --- a/ecc/bw6-633/internal/fptower/e3.go +++ b/ecc/bw6-633/internal/fptower/e3.go @@ -21,7 +21,7 @@ type E3 struct { A0, A1, A2 fp.Element } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise // TODO can this be deleted? Should be able to use == operator instead func (z *E3) Equal(x *E3) bool { return z.A0.Equal(&x.A0) && z.A1.Equal(&x.A1) && z.A2.Equal(&x.A2) @@ -82,7 +82,7 @@ func (z *E3) SetRandom() (*E3, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E3) IsZero() bool { return z.A0.IsZero() && z.A1.IsZero() && z.A2.IsZero() } diff --git a/ecc/bw6-633/internal/fptower/e6.go b/ecc/bw6-633/internal/fptower/e6.go index 5a86ac7703..c04aedc072 100644 --- a/ecc/bw6-633/internal/fptower/e6.go +++ b/ecc/bw6-633/internal/fptower/e6.go @@ -35,7 +35,7 @@ type E6 struct { B0, B1 E3 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) } @@ -98,7 +98,7 @@ func (z *E6) SetRandom() (*E6, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E6) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() } @@ -691,7 +691,7 @@ func (z *E6) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E6 is in correct sugroup +// IsInSubGroup ensures GT/E6 is in correct subgroup func (z *E6) IsInSubGroup() bool { var tmp, a, _a, b E6 var t [13]E6 diff --git a/ecc/bw6-633/multiexp.go b/ecc/bw6-633/multiexp.go index 93e279ac6f..e5bdcbb41a 100644 --- a/ecc/bw6-633/multiexp.go +++ b/ecc/bw6-633/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -251,7 +251,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -261,7 +261,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -271,7 +271,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -313,7 +313,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -450,13 +450,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -475,7 +475,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -532,7 +532,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bw6-633/multiexp_affine.go b/ecc/bw6-633/multiexp_affine.go index ae821f8bbe..7272cadee9 100644 --- a/ecc/bw6-633/multiexp_affine.go +++ b/ecc/bw6-633/multiexp_affine.go @@ -46,7 +46,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -302,7 +302,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bw6-633/multiexp_jacobian.go b/ecc/bw6-633/multiexp_jacobian.go index 2d992da14c..96efd1f61e 100644 --- a/ecc/bw6-633/multiexp_jacobian.go +++ b/ecc/bw6-633/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -94,7 +94,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bw6-633/multiexp_test.go b/ecc/bw6-633/multiexp_test.go index 4651adb796..e17370e5e3 100644 --- a/ecc/bw6-633/multiexp_test.go +++ b/ecc/bw6-633/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bw6-633/twistededwards/eddsa/eddsa.go b/ecc/bw6-633/twistededwards/eddsa/eddsa.go index 64468787f7..554aeaceee 100644 --- a/ecc/bw6-633/twistededwards/eddsa/eddsa.go +++ b/ecc/bw6-633/twistededwards/eddsa/eddsa.go @@ -66,7 +66,7 @@ func GenerateKey(r io.Reader) (*PrivateKey, error) { var pub PublicKey var priv PrivateKey // The source of randomness and the secret scalar must come - // from 2 distincts sources. Since the scalar is the size of the + // from 2 distinct sources. Since the scalar is the size of the // field of definition (48 bytes), the scalar must come from a // different digest so there is no overlap between the source of // randomness and the scalar. diff --git a/ecc/bw6-633/twistededwards/eddsa/eddsa_test.go b/ecc/bw6-633/twistededwards/eddsa/eddsa_test.go index 066a7ac20a..a3e75f5c4f 100644 --- a/ecc/bw6-633/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bw6-633/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bw6-633/twistededwards/eddsa/marshal.go b/ecc/bw6-633/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bw6-633/twistededwards/eddsa/marshal.go +++ b/ecc/bw6-633/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bw6-756/fp/element.go b/ecc/bw6-756/fp/element.go index ab7dcde2d7..5f9fe192f5 100644 --- a/ecc/bw6-756/fp/element.go +++ b/ecc/bw6-756/fp/element.go @@ -422,7 +422,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bw6-756/fr/kzg/kzg_test.go b/ecc/bw6-756/fr/kzg/kzg_test.go index 92446f9d7a..4e3d7285d2 100644 --- a/ecc/bw6-756/fr/kzg/kzg_test.go +++ b/ecc/bw6-756/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bw6-756/fr/plookup/vector.go b/ecc/bw6-756/fr/plookup/vector.go index 3a034baefd..63834a44fb 100644 --- a/ecc/bw6-756/fr/plookup/vector.go +++ b/ecc/bw6-756/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bw6-756/fr/polynomial/polynomial_test.go b/ecc/bw6-756/fr/polynomial/polynomial_test.go index 414f3a3079..34e8749c72 100644 --- a/ecc/bw6-756/fr/polynomial/polynomial_test.go +++ b/ecc/bw6-756/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bw6-756/fr/polynomial/pool.go b/ecc/bw6-756/fr/polynomial/pool.go index 06fca83cfd..9b37e72e4b 100644 --- a/ecc/bw6-756/fr/polynomial/pool.go +++ b/ecc/bw6-756/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bw6-756/g1.go b/ecc/bw6-756/g1.go index de931f160f..eca93a4065 100644 --- a/ecc/bw6-756/g1.go +++ b/ecc/bw6-756/g1.go @@ -1132,7 +1132,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bw6-756/g2.go b/ecc/bw6-756/g2.go index 40c786ce8b..f0ba94d23d 100644 --- a/ecc/bw6-756/g2.go +++ b/ecc/bw6-756/g2.go @@ -909,7 +909,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bw6-756/internal/fptower/e3.go b/ecc/bw6-756/internal/fptower/e3.go index 148fecded9..b2fa2859d0 100644 --- a/ecc/bw6-756/internal/fptower/e3.go +++ b/ecc/bw6-756/internal/fptower/e3.go @@ -21,7 +21,7 @@ type E3 struct { A0, A1, A2 fp.Element } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise // note this is more efficient than calling "z == x" func (z *E3) Equal(x *E3) bool { return z.A0.Equal(&x.A0) && z.A1.Equal(&x.A1) && z.A2.Equal(&x.A2) @@ -78,7 +78,7 @@ func (z *E3) SetRandom() (*E3, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E3) IsZero() bool { return z.A0.IsZero() && z.A1.IsZero() && z.A2.IsZero() } diff --git a/ecc/bw6-756/internal/fptower/e6.go b/ecc/bw6-756/internal/fptower/e6.go index 71f2b305c1..5302874149 100644 --- a/ecc/bw6-756/internal/fptower/e6.go +++ b/ecc/bw6-756/internal/fptower/e6.go @@ -35,7 +35,7 @@ type E6 struct { B0, B1 E3 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) } @@ -97,7 +97,7 @@ func (z *E6) SetRandom() (*E6, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E6) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() } @@ -613,7 +613,7 @@ func (z *E6) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E6 is in correct sugroup +// IsInSubGroup ensures GT/E6 is in correct subgroup func (z *E6) IsInSubGroup() bool { var tmp, a, _a, b E6 var t [6]E6 diff --git a/ecc/bw6-756/multiexp.go b/ecc/bw6-756/multiexp.go index fa9bd11b00..c20a86f563 100644 --- a/ecc/bw6-756/multiexp.go +++ b/ecc/bw6-756/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -251,7 +251,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -261,7 +261,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -271,7 +271,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -313,7 +313,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -450,13 +450,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -475,7 +475,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -532,7 +532,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bw6-756/multiexp_affine.go b/ecc/bw6-756/multiexp_affine.go index 086c2e9f83..ce9b48daed 100644 --- a/ecc/bw6-756/multiexp_affine.go +++ b/ecc/bw6-756/multiexp_affine.go @@ -46,7 +46,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -302,7 +302,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bw6-756/multiexp_jacobian.go b/ecc/bw6-756/multiexp_jacobian.go index cd15044132..2f8d9904e1 100644 --- a/ecc/bw6-756/multiexp_jacobian.go +++ b/ecc/bw6-756/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -94,7 +94,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bw6-756/multiexp_test.go b/ecc/bw6-756/multiexp_test.go index 6381f5e9d2..e45d451a89 100644 --- a/ecc/bw6-756/multiexp_test.go +++ b/ecc/bw6-756/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bw6-756/twistededwards/eddsa/eddsa.go b/ecc/bw6-756/twistededwards/eddsa/eddsa.go index cca418c74c..13f4e45124 100644 --- a/ecc/bw6-756/twistededwards/eddsa/eddsa.go +++ b/ecc/bw6-756/twistededwards/eddsa/eddsa.go @@ -66,7 +66,7 @@ func GenerateKey(r io.Reader) (*PrivateKey, error) { var pub PublicKey var priv PrivateKey // The source of randomness and the secret scalar must come - // from 2 distincts sources. Since the scalar is the size of the + // from 2 distinct sources. Since the scalar is the size of the // field of definition (48 bytes), the scalar must come from a // different digest so there is no overlap between the source of // randomness and the scalar. diff --git a/ecc/bw6-756/twistededwards/eddsa/eddsa_test.go b/ecc/bw6-756/twistededwards/eddsa/eddsa_test.go index 82388cfdd4..b83ba2805d 100644 --- a/ecc/bw6-756/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bw6-756/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bw6-756/twistededwards/eddsa/marshal.go b/ecc/bw6-756/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bw6-756/twistededwards/eddsa/marshal.go +++ b/ecc/bw6-756/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/bw6-761/fp/element.go b/ecc/bw6-761/fp/element.go index 72ff7dda25..93aa6d6c71 100644 --- a/ecc/bw6-761/fp/element.go +++ b/ecc/bw6-761/fp/element.go @@ -422,7 +422,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/ecc/bw6-761/fr/kzg/kzg_test.go b/ecc/bw6-761/fr/kzg/kzg_test.go index a482066475..5b103701d7 100644 --- a/ecc/bw6-761/fr/kzg/kzg_test.go +++ b/ecc/bw6-761/fr/kzg/kzg_test.go @@ -142,7 +142,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/ecc/bw6-761/fr/plookup/vector.go b/ecc/bw6-761/fr/plookup/vector.go index 25be7af31b..9b86308900 100644 --- a/ecc/bw6-761/fr/plookup/vector.go +++ b/ecc/bw6-761/fr/plookup/vector.go @@ -349,7 +349,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -673,7 +673,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/ecc/bw6-761/fr/polynomial/polynomial_test.go b/ecc/bw6-761/fr/polynomial/polynomial_test.go index c293e9a26f..cb0857b519 100644 --- a/ecc/bw6-761/fr/polynomial/polynomial_test.go +++ b/ecc/bw6-761/fr/polynomial/polynomial_test.go @@ -171,7 +171,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/ecc/bw6-761/fr/polynomial/pool.go b/ecc/bw6-761/fr/polynomial/pool.go index fc3ccd4891..96d581d0f7 100644 --- a/ecc/bw6-761/fr/polynomial/pool.go +++ b/ecc/bw6-761/fr/polynomial/pool.go @@ -49,7 +49,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *fr.Element { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*fr.Element) } @@ -153,7 +153,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/ecc/bw6-761/g1.go b/ecc/bw6-761/g1.go index 958fe74501..827dbf89f9 100644 --- a/ecc/bw6-761/g1.go +++ b/ecc/bw6-761/g1.go @@ -1143,7 +1143,7 @@ func BatchScalarMultiplicationG1(base *G1Affine, scalars []fr.Element) []G1Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddMixed(&baseTableAff[(digit>>1)-1]) diff --git a/ecc/bw6-761/g2.go b/ecc/bw6-761/g2.go index 73a3a9ba8c..7b68546312 100644 --- a/ecc/bw6-761/g2.go +++ b/ecc/bw6-761/g2.go @@ -923,7 +923,7 @@ func BatchScalarMultiplicationG2(base *G2Affine, scalars []fr.Element) []G2Affin continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add p.AddAssign(&baseTable[(digit>>1)-1]) diff --git a/ecc/bw6-761/internal/fptower/e3.go b/ecc/bw6-761/internal/fptower/e3.go index 5f2a5d537c..7434ebd59c 100644 --- a/ecc/bw6-761/internal/fptower/e3.go +++ b/ecc/bw6-761/internal/fptower/e3.go @@ -21,7 +21,7 @@ type E3 struct { A0, A1, A2 fp.Element } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise // note this is more efficient than calling "z == x" func (z *E3) Equal(x *E3) bool { return z.A0.Equal(&x.A0) && z.A1.Equal(&x.A1) && z.A2.Equal(&x.A2) @@ -78,7 +78,7 @@ func (z *E3) SetRandom() (*E3, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E3) IsZero() bool { return z.A0.IsZero() && z.A1.IsZero() && z.A2.IsZero() } diff --git a/ecc/bw6-761/internal/fptower/e6.go b/ecc/bw6-761/internal/fptower/e6.go index 046e3eec5d..09c1e52a89 100644 --- a/ecc/bw6-761/internal/fptower/e6.go +++ b/ecc/bw6-761/internal/fptower/e6.go @@ -35,7 +35,7 @@ type E6 struct { B0, B1 E3 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) } @@ -97,7 +97,7 @@ func (z *E6) SetRandom() (*E6, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E6) IsZero() bool { return z.B0.IsZero() && z.B1.IsZero() } @@ -613,7 +613,7 @@ func (z *E6) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E6 is in correct sugroup +// IsInSubGroup ensures GT/E6 is in correct subgroup func (z *E6) IsInSubGroup() bool { var tmp, a, _a, b E6 var t [6]E6 diff --git a/ecc/bw6-761/multiexp.go b/ecc/bw6-761/multiexp.go index 3f39f3c6e0..71fff74f7e 100644 --- a/ecc/bw6-761/multiexp.go +++ b/ecc/bw6-761/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -253,7 +253,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -263,7 +263,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -273,7 +273,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -315,7 +315,7 @@ func (p *G2Jac) MultiExp(points []G2Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -454,13 +454,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -479,7 +479,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -536,7 +536,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/bw6-761/multiexp_affine.go b/ecc/bw6-761/multiexp_affine.go index 5f423838c4..5cbc271e32 100644 --- a/ecc/bw6-761/multiexp_affine.go +++ b/ecc/bw6-761/multiexp_affine.go @@ -46,7 +46,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. @@ -302,7 +302,7 @@ func processChunkG2BatchAffine[BJE ibg2JacExtended, B ibG2Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g2JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/bw6-761/multiexp_jacobian.go b/ecc/bw6-761/multiexp_jacobian.go index ca6b1610da..b300811d94 100644 --- a/ecc/bw6-761/multiexp_jacobian.go +++ b/ecc/bw6-761/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) @@ -96,7 +96,7 @@ func processChunkG2Jacobian[B ibg2JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/bw6-761/multiexp_test.go b/ecc/bw6-761/multiexp_test.go index 01184d325c..05173f16a3 100644 --- a/ecc/bw6-761/multiexp_test.go +++ b/ecc/bw6-761/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac @@ -489,7 +489,7 @@ func TestMultiExpG2(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G2] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G2] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G2Affine for i := 0; i < 13; i++ { @@ -519,7 +519,7 @@ func TestMultiExpG2(t *testing.T) { // test only "odd" and "even" (ie windows size divide word size vs not) cRange := []uint64{5, 14} - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G2Jac @@ -552,7 +552,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G2Affine @@ -588,7 +588,7 @@ func TestMultiExpG2(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G2] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G2] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -610,7 +610,7 @@ func TestMultiExpG2(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G2] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G2] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G2Jac diff --git a/ecc/bw6-761/twistededwards/eddsa/eddsa.go b/ecc/bw6-761/twistededwards/eddsa/eddsa.go index c0facc74e6..fb00ae2844 100644 --- a/ecc/bw6-761/twistededwards/eddsa/eddsa.go +++ b/ecc/bw6-761/twistededwards/eddsa/eddsa.go @@ -66,7 +66,7 @@ func GenerateKey(r io.Reader) (*PrivateKey, error) { var pub PublicKey var priv PrivateKey // The source of randomness and the secret scalar must come - // from 2 distincts sources. Since the scalar is the size of the + // from 2 distinct sources. Since the scalar is the size of the // field of definition (48 bytes), the scalar must come from a // different digest so there is no overlap between the source of // randomness and the scalar. diff --git a/ecc/bw6-761/twistededwards/eddsa/eddsa_test.go b/ecc/bw6-761/twistededwards/eddsa/eddsa_test.go index f8929c461a..9e145fbaad 100644 --- a/ecc/bw6-761/twistededwards/eddsa/eddsa_test.go +++ b/ecc/bw6-761/twistededwards/eddsa/eddsa_test.go @@ -77,7 +77,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -89,7 +89,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -125,7 +125,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -136,7 +136,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -168,7 +168,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -177,7 +177,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/ecc/bw6-761/twistededwards/eddsa/marshal.go b/ecc/bw6-761/twistededwards/eddsa/marshal.go index 485e9b7100..acf3c41737 100644 --- a/ecc/bw6-761/twistededwards/eddsa/marshal.go +++ b/ecc/bw6-761/twistededwards/eddsa/marshal.go @@ -96,7 +96,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // - x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -111,7 +111,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // - x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// - s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// - s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // diff --git a/ecc/secp256k1/fp/element.go b/ecc/secp256k1/fp/element.go index 9daa6873e7..753c2f3866 100644 --- a/ecc/secp256k1/fp/element.go +++ b/ecc/secp256k1/fp/element.go @@ -334,7 +334,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1<>1)-1]) diff --git a/ecc/secp256k1/multiexp.go b/ecc/secp256k1/multiexp.go index 792459cc32..319f27b807 100644 --- a/ecc/secp256k1/multiexp.go +++ b/ecc/secp256k1/multiexp.go @@ -45,7 +45,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -55,7 +55,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -65,7 +65,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -107,7 +107,7 @@ func (p *G1Jac) MultiExp(points []G1Affine, scalars []fr.Element, config ecc.Mul // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints / 2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit * 2 @@ -288,13 +288,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits + c - 1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -313,7 +313,7 @@ type chunkStat struct { } // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -370,7 +370,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [] digit += int(scalar[s.index+1]&s.maskHigh) << s.shiftHigh } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) diff --git a/ecc/secp256k1/multiexp_affine.go b/ecc/secp256k1/multiexp_affine.go index 722733e23b..a6c0abef82 100644 --- a/ecc/secp256k1/multiexp_affine.go +++ b/ecc/secp256k1/multiexp_affine.go @@ -46,7 +46,7 @@ func processChunkG1BatchAffine[BJE ibg1JacExtended, B ibG1Affine, BS bitSet, TP // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // g1JacExtended coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/ecc/secp256k1/multiexp_jacobian.go b/ecc/secp256k1/multiexp_jacobian.go index e7dd70df48..eaa737d3bd 100644 --- a/ecc/secp256k1/multiexp_jacobian.go +++ b/ecc/secp256k1/multiexp_jacobian.go @@ -33,7 +33,7 @@ func processChunkG1Jacobian[B ibg1JacExtended](chunk uint64, continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit&1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/ecc/secp256k1/multiexp_test.go b/ecc/secp256k1/multiexp_test.go index 8055985ce3..b3f2e74f35 100644 --- a/ecc/secp256k1/multiexp_test.go +++ b/ecc/secp256k1/multiexp_test.go @@ -73,7 +73,7 @@ func TestMultiExpG1(t *testing.T) { scalar.Div(&scalar, new(big.Int).SetInt64(6)) // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[G1] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[G1] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples * 13]G1Affine for i := 0; i < 13; i++ { @@ -105,7 +105,7 @@ func TestMultiExpG1(t *testing.T) { cRange = []uint64{5, 14} } - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected G1Jac @@ -138,7 +138,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]G1Affine @@ -174,7 +174,7 @@ func TestMultiExpG1(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[G1] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[G1] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -196,7 +196,7 @@ func TestMultiExpG1(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[G1] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[G1] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g G1Jac diff --git a/ecc/stark-curve/fp/element.go b/ecc/stark-curve/fp/element.go index 9d729df35a..073dc4081b 100644 --- a/ecc/stark-curve/fp/element.go +++ b/ecc/stark-curve/fp/element.go @@ -334,7 +334,7 @@ func (z *Element) SetRandom() (*Element, error) { return nil, err } - // Clear unused bits in in the most signicant byte to increase probability + // Clear unused bits in in the most significant byte to increase probability // that the candidate is < q. bytes[k-1] &= uint8(int(1< c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -94,7 +94,7 @@ func Generate(conf config.Curve, baseDir string, bgen *bavard.BatchGenerator) er // in theory, larger batch size == less inversions // but if nbBuckets is small, then a large batch size will produce lots of collisions // and queue ops. - // there is probably a cache-friendlyness factor at play here too. + // there is probably a cache-friendliness factor at play here too. switch c { case 10: return 80 diff --git a/internal/generator/ecc/template/multiexp.go.tmpl b/internal/generator/ecc/template/multiexp.go.tmpl index 7dd57048c3..b79994d7f5 100644 --- a/internal/generator/ecc/template/multiexp.go.tmpl +++ b/internal/generator/ecc/template/multiexp.go.tmpl @@ -37,13 +37,13 @@ type selector struct { } // return number of chunks for a given window size c -// the last chunk may be bigger to accomodate a potential carry from the NAF decomposition +// the last chunk may be bigger to accommodate a potential carry from the NAF decomposition func computeNbChunks(c uint64) uint64 { return (fr.Bits+c-1) / c } // return the last window size for a scalar; -// this last window should accomodate a carry (from the NAF decomposition) +// this last window should accommodate a carry (from the NAF decomposition) // it can be == c if we have 1 available bit // it can be > c if we have 0 available bit // it can be < c if we have 2+ available bits @@ -64,7 +64,7 @@ type chunkStat struct { // partitionScalars compute, for each scalars over c-bit wide windows, nbChunk digits -// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract +// if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits can be processed in a later step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets in the MultiExp or BatchScalarMultiplication) @@ -124,7 +124,7 @@ func partitionScalars(scalars []fr.Element, c uint64, nbTasks int) ([]uint16, [ } - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. if digit > max { digit -= (1 << c) @@ -244,7 +244,7 @@ func (p *{{ $.TJacobian }}) MultiExp(points []{{ $.TAffine }}, scalars []fr.Elem // each of the msmCX method is the same, except for the c constant it declares // duplicating (through template generation) these methods allows to declare the buckets on the stack // the choice of c needs to be improved: - // there is a theoritical value that gives optimal asymptotics + // there is a theoretical value that gives optimal asymptotics // but in practice, other factors come into play, including: // * if c doesn't divide 64, the word size, then we're bound to select bits over 2 words of our scalars, instead of 1 // * number of CPUs @@ -254,7 +254,7 @@ func (p *{{ $.TJacobian }}) MultiExp(points []{{ $.TAffine }}, scalars []fr.Elem // for each msmCX // step 1 // we compute, for each scalars over c-bit wide windows, nbChunk digits - // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and substract + // if the digit is larger than 2^{c-1}, then, we borrow 2^c from the next window and subtract // 2^{c} to the current digit, making it negative. // negative digits will be processed in the next step as adding -G into the bucket instead of G // (computing -G is cheap, and this saves us half of the buckets) @@ -264,7 +264,7 @@ func (p *{{ $.TJacobian }}) MultiExp(points []{{ $.TAffine }}, scalars []fr.Elem // we use jacobian extended formulas here as they are faster than mixed addition // msmProcessChunk places points into buckets base on their selector and return the weighted bucket sum in given channel // step 3 - // reduce the buckets weigthed sums into our result (msmReduceChunk) + // reduce the buckets weighed sums into our result (msmReduceChunk) // ensure len(points) == len(scalars) nbPoints := len(points) @@ -308,7 +308,7 @@ func (p *{{ $.TJacobian }}) MultiExp(points []{{ $.TAffine }}, scalars []fr.Elem // if we don't utilise all the tasks (CPU in the default case) that we could, let's see if it's worth it to split if config.NbTasks > 1 && nbChunks < config.NbTasks { - // before spliting, let's see if we endup with more tasks than thread; + // before splitting, let's see if we end up with more tasks than thread; cSplit := bestC(nbPoints/2) nbChunksPostSplit := int(computeNbChunks(cSplit)) nbTasksPostSplit := nbChunksPostSplit*2 diff --git a/internal/generator/ecc/template/multiexp_affine.go.tmpl b/internal/generator/ecc/template/multiexp_affine.go.tmpl index edb687829c..6c4672b3de 100644 --- a/internal/generator/ecc/template/multiexp_affine.go.tmpl +++ b/internal/generator/ecc/template/multiexp_affine.go.tmpl @@ -48,7 +48,7 @@ func processChunk{{ $.UPointName }}BatchAffine[BJE ib{{ $.TJacobianExtended }},B // if the queue is full, we "flush it"; we sequentially add the points to the buckets in // {{ $.TJacobianExtended }} coordinates. // The reasoning behind this is the following; batchSize is chosen such as, for a uniformly random - // input, the number of conflicts is going to be low, and the element added to the queue should be immediatly + // input, the number of conflicts is going to be low, and the element added to the queue should be immediately // processed in the next batch. If it's not the case, then our inputs are not random; and we fallback to // non-batch-affine version. diff --git a/internal/generator/ecc/template/multiexp_jacobian.go.tmpl b/internal/generator/ecc/template/multiexp_jacobian.go.tmpl index 27112dbdae..89b4fbe80e 100644 --- a/internal/generator/ecc/template/multiexp_jacobian.go.tmpl +++ b/internal/generator/ecc/template/multiexp_jacobian.go.tmpl @@ -36,7 +36,7 @@ func processChunk{{ $.UPointName }}Jacobian[B ib{{ $.TJacobianExtended }}](chunk continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit & 1 == 0 { // add buckets[(digit>>1)-1].addMixed(&points[i]) diff --git a/internal/generator/ecc/template/point.go.tmpl b/internal/generator/ecc/template/point.go.tmpl index bd73443609..6fcddde167 100644 --- a/internal/generator/ecc/template/point.go.tmpl +++ b/internal/generator/ecc/template/point.go.tmpl @@ -1671,7 +1671,7 @@ func BatchScalarMultiplication{{ toUpper .PointName }}(base *{{ $TAffine }}, sca continue } - // if msbWindow bit is set, we need to substract + // if msbWindow bit is set, we need to subtract if digit & 1 == 0 { // add {{- if eq .PointName "g1"}} diff --git a/internal/generator/ecc/template/tests/multiexp.go.tmpl b/internal/generator/ecc/template/tests/multiexp.go.tmpl index 24f4bad146..e6bf734091 100644 --- a/internal/generator/ecc/template/tests/multiexp.go.tmpl +++ b/internal/generator/ecc/template/tests/multiexp.go.tmpl @@ -76,7 +76,7 @@ func TestMultiExp{{$.UPointName}}(t *testing.T) { // ensure a multiexp that's splitted has the same result as a non-splitted one.. - properties.Property("[{{ $.UPointName }}] Multi exponentation (cmax) should be consistent with splitted multiexp", prop.ForAll( + properties.Property("[{{ $.UPointName }}] Multi exponentiation (cmax) should be consistent with splitted multiexp", prop.ForAll( func(mixer fr.Element) bool { var samplePointsLarge [nbSamples*13]{{ $.TAffine }} for i:=0; i<13; i++ { @@ -116,7 +116,7 @@ func TestMultiExp{{$.UPointName}}(t *testing.T) { cRange := []uint64{5, 14} {{- end}} - properties.Property(fmt.Sprintf("[{{ $.UPointName }}] Multi exponentation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[{{ $.UPointName }}] Multi exponentiation (c in %v) should be consistent with sum of square", cRange), prop.ForAll( func(mixer fr.Element) bool { var expected {{ $.TJacobian }} @@ -150,7 +150,7 @@ func TestMultiExp{{$.UPointName}}(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[{{ $.UPointName }}] Multi exponentation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[{{ $.UPointName }}] Multi exponentiation (c in %v) of points at infinity should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { var samplePointsZero [nbSamples]{{ $.TAffine }} @@ -186,7 +186,7 @@ func TestMultiExp{{$.UPointName}}(t *testing.T) { genScalar, )) - properties.Property(fmt.Sprintf("[{{ $.UPointName }}] Multi exponentation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( + properties.Property(fmt.Sprintf("[{{ $.UPointName }}] Multi exponentiation (c in %v) with a vector of 0s as input should output a point at infinity", cRange), prop.ForAll( func(mixer fr.Element) bool { // mixer ensures that all the words of a fpElement are set var sampleScalars [nbSamples]fr.Element @@ -210,7 +210,7 @@ func TestMultiExp{{$.UPointName}}(t *testing.T) { // note : this test is here as we expect to have a different multiExp than the above bucket method // for small number of points - properties.Property("[{{ $.UPointName }}] Multi exponentation (<50points) should be consistent with sum of square", prop.ForAll( + properties.Property("[{{ $.UPointName }}] Multi exponentiation (<50points) should be consistent with sum of square", prop.ForAll( func(mixer fr.Element) bool { var g {{ $.TJacobian }} diff --git a/internal/generator/edwards/eddsa/template/eddsa.go.tmpl b/internal/generator/edwards/eddsa/template/eddsa.go.tmpl index 7b345572da..938edd7028 100644 --- a/internal/generator/edwards/eddsa/template/eddsa.go.tmpl +++ b/internal/generator/edwards/eddsa/template/eddsa.go.tmpl @@ -51,7 +51,7 @@ func GenerateKey(r io.Reader) (*PrivateKey, error) { {{- if or (eq .Name "bw6-761") (eq .Name "bw6-633") (eq .Name "bw6-756")}} // The source of randomness and the secret scalar must come - // from 2 distincts sources. Since the scalar is the size of the + // from 2 distinct sources. Since the scalar is the size of the // field of definition (48 bytes), the scalar must come from a // different digest so there is no overlap between the source of // randomness and the scalar. diff --git a/internal/generator/edwards/eddsa/template/eddsa.test.go.tmpl b/internal/generator/edwards/eddsa/template/eddsa.test.go.tmpl index 2b34c551ef..7cb21bd856 100644 --- a/internal/generator/edwards/eddsa/template/eddsa.test.go.tmpl +++ b/internal/generator/edwards/eddsa/template/eddsa.test.go.tmpl @@ -60,7 +60,7 @@ func TestSerialization(t *testing.T) { pubKey2.SetBytes(pubKeyBin1) pubKeyBin2 := pubKey2.Bytes() if len(pubKeyBin1) != len(pubKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(pubKeyBin1); i++ { if pubKeyBin1[i] != pubKeyBin2[i] { @@ -72,7 +72,7 @@ func TestSerialization(t *testing.T) { privKey2.SetBytes(privKeyBin1) privKeyBin2 := privKey2.Bytes() if len(privKeyBin1) != len(privKeyBin2) { - t.Fatal("Inconistent size") + t.Fatal("Inconsistent size") } for i := 0; i < len(privKeyBin1); i++ { if privKeyBin1[i] != privKeyBin2[i] { @@ -108,7 +108,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -119,7 +119,7 @@ func TestEddsaMIMC(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } @@ -151,7 +151,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if !res { - t.Fatal("Verifiy correct signature should return true") + t.Fatal("Verify correct signature should return true") } // verifies wrong msg @@ -160,7 +160,7 @@ func TestEddsaSHA256(t *testing.T) { t.Fatal(err) } if res { - t.Fatal("Verfiy wrong signature should be false") + t.Fatal("Verify wrong signature should be false") } } diff --git a/internal/generator/edwards/eddsa/template/marshal.go.tmpl b/internal/generator/edwards/eddsa/template/marshal.go.tmpl index a299cb637a..398ac6df83 100644 --- a/internal/generator/edwards/eddsa/template/marshal.go.tmpl +++ b/internal/generator/edwards/eddsa/template/marshal.go.tmpl @@ -4,9 +4,9 @@ import ( ) // Bytes returns the binary representation of the public key -// follows https://tools.ietf.org/html/rfc8032#section-3.1 +// follows https://tools.ietf.org/html/rfc8032#section-3.1 // and returns a compressed representation of the point (x,y) -// +// // x, y are the coordinates of the point // on the twisted Edwards as big endian integers. // compressed representation store x with a parity bit to recompute y @@ -28,7 +28,7 @@ func (pk *PublicKey) SetBytes(buf []byte) (int, error) { return n, io.ErrShortBuffer } if _, err := pk.A.SetBytes(buf[:sizeFr]); err != nil { - return 0, err + return 0, err } n += sizeFr if !pk.A.IsOnCurve() { @@ -78,7 +78,7 @@ func (privKey *PrivateKey) SetBytes(buf []byte) (int, error) { // as a byte array of size 3*sizeFr x||y||s where // * x, y are the coordinates of a point on the twisted // Edwards represented in big endian -// * s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// * s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) func (sig *Signature) Bytes() []byte { @@ -93,7 +93,7 @@ func (sig *Signature) Bytes() []byte { // buf is read interpreted as x||y||s where // * x,y are the coordinates of a point on the twisted // Edwards represented in big endian -// * s=r+h(r,a,m) mod l, the Hasse bound guarantess that +// * s=r+h(r,a,m) mod l, the Hasse bound guarantees that // s is smaller than sizeFr (in particular it is supposed // s is NOT blinded) // It returns the number of bytes read from buf. @@ -103,7 +103,7 @@ func (sig *Signature) SetBytes(buf []byte) (int, error) { return n, io.ErrShortBuffer } if _, err := sig.R.SetBytes(buf[:sizeFr]); err != nil { - return 0, err + return 0, err } n += sizeFr if !sig.R.IsOnCurve() { diff --git a/internal/generator/kzg/template/fuzz.go.tmpl b/internal/generator/kzg/template/fuzz.go.tmpl index 9ee81d02f8..baea473a73 100644 --- a/internal/generator/kzg/template/fuzz.go.tmpl +++ b/internal/generator/kzg/template/fuzz.go.tmpl @@ -19,7 +19,7 @@ func Fuzz(data []byte) int { size = 1 << 15 } r := bytes.NewReader(data[1:]) - var alpha, point fr.Element + var alpha, point fr.Element alpha.SetRawBytes(r) point.SetRawBytes(r) s := NewScheme(size, alpha) @@ -49,7 +49,7 @@ func Fuzz(data []byte) int { for i := 0; i < len(f); i++ { expectedClaim := f[i].Eval(&point) if !expectedClaim.Equal(&proof.ClaimedValues[i]) { - panic("inconsistant claimed values") + panic("inconsistent claimed values") } } @@ -64,4 +64,4 @@ func Fuzz(data []byte) int { } - + diff --git a/internal/generator/kzg/template/kzg.go.tmpl b/internal/generator/kzg/template/kzg.go.tmpl index d5918e535f..382b81cd2c 100644 --- a/internal/generator/kzg/template/kzg.go.tmpl +++ b/internal/generator/kzg/template/kzg.go.tmpl @@ -261,7 +261,7 @@ func BatchOpenSinglePoint(polynomials [][]fr.Element, digests []Digest, point fr }() // compute ∑ᵢγⁱfᵢ - // note: if we are willing to paralellize that, we could clone the poly and scale them by + // note: if we are willing to parallelize that, we could clone the poly and scale them by // gamma n in parallel, before reducing into foldedPolynomials foldedPolynomials := make([]fr.Element, largestPoly) copy(foldedPolynomials, polynomials[0]) @@ -524,7 +524,7 @@ func dividePolyByXminusA(f []fr.Element, fa, a fr.Element) []fr.Element { // first we compute f-f(a) f[0].Sub(&f[0], &fa) - // now we use syntetic division to divide by x-a + // now we use synthetic division to divide by x-a var t fr.Element for i := len(f) - 2; i >= 0; i-- { t.Mul(&f[i+1], &a) diff --git a/internal/generator/kzg/template/kzg.test.go.tmpl b/internal/generator/kzg/template/kzg.test.go.tmpl index 31c82727a4..91fc650c54 100644 --- a/internal/generator/kzg/template/kzg.test.go.tmpl +++ b/internal/generator/kzg/template/kzg.test.go.tmpl @@ -124,7 +124,7 @@ func TestVerifySinglePoint(t *testing.T) { // verify the claimed valued expected := eval(f, point) if !proof.ClaimedValue.Equal(&expected) { - t.Fatal("inconsistant claimed value") + t.Fatal("inconsistent claimed value") } // verify correct proof diff --git a/internal/generator/plookup/template/vector.go.tmpl b/internal/generator/plookup/template/vector.go.tmpl index a506523b4b..56af2c6974 100644 --- a/internal/generator/plookup/template/vector.go.tmpl +++ b/internal/generator/plookup/template/vector.go.tmpl @@ -331,7 +331,7 @@ func computeQuotientCanonical(alpha fr.Element, lh, lh0, lhn, lh1h2 []fr.Element // // /!\IMPORTANT/!\ // -// If the table t is already commited somewhere (which is the normal workflow +// If the table t is already committed somewhere (which is the normal workflow // before generating a lookup proof), the commitment needs to be done on the // table sorted. Otherwise the commitment in proof.t will not be the same as // the public commitment: it will contain the same values, but permuted. @@ -656,7 +656,7 @@ func VerifyLookupVector(vk kzg.VerifyingKey, proof ProofLookupVector) error { lhs.Sub(&lhs, &rhs) - // check consistancy of bounds + // check consistency of bounds var l0, ln, d1, d2 fr.Element l0.Exp(nu, big.NewInt(int64(proof.size))).Sub(&l0, &one) ln.Set(&l0) diff --git a/internal/generator/polynomial/template/polynomial.test.go.tmpl b/internal/generator/polynomial/template/polynomial.test.go.tmpl index 727b2f2e1f..441a70da83 100644 --- a/internal/generator/polynomial/template/polynomial.test.go.tmpl +++ b/internal/generator/polynomial/template/polynomial.test.go.tmpl @@ -153,7 +153,7 @@ func TestPolynomialAdd(t *testing.T) { t.Fatal("side effect, f2 should not have been modified") } - // all operands are distincts + // all operands are distinct _f1 := f1.Clone() _f1.Add(f1, f2) if !_f1.Equal(expectedSum) { diff --git a/internal/generator/polynomial/template/pool.go.tmpl b/internal/generator/polynomial/template/pool.go.tmpl index 1555ff84ae..d3a03c12eb 100644 --- a/internal/generator/polynomial/template/pool.go.tmpl +++ b/internal/generator/polynomial/template/pool.go.tmpl @@ -56,7 +56,7 @@ type Pool struct { } func (p *sizedPool) get(n int) *{{.ElementType}} { - p.stats.maake(n) + p.stats.make(n) return p.pool.Get().(*{{.ElementType}}) } @@ -160,7 +160,7 @@ type poolsStats struct { InUse int } -func (s *poolStats) maake(n int) { +func (s *poolStats) make(n int) { s.Used++ s.InUse++ if n > s.GreatestNUsed { diff --git a/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl b/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl index eaddb89fff..6a5eb49124 100644 --- a/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl +++ b/internal/generator/tower/template/fq12over6over2/fq12.go.tmpl @@ -18,7 +18,7 @@ type E12 struct { C0, C1 E6 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E12) Equal(x *E12) bool { return z.C0.Equal(&x.C0) && z.C1.Equal(&x.C1) } @@ -81,7 +81,7 @@ func (z *E12) SetRandom() (*E12, error) { return z, nil } -// IsZero returns true if the two elements are equal, fasle otherwise +// IsZero returns true if the two elements are equal, false otherwise func (z *E12) IsZero() bool { return z.C0.IsZero() && z.C1.IsZero() } @@ -630,7 +630,7 @@ func (z *E12) Marshal() ([]byte) { return b[:] } -// Unmarshal is an allias to SetBytes() +// Unmarshal is an alias to SetBytes() func (z *E12) Unmarshal(buf []byte) error { return z.SetBytes(buf) } @@ -727,7 +727,7 @@ func (z *E12) SetBytes(e []byte) error { return nil } -// IsInSubGroup ensures GT/E12 is in correct sugroup +// IsInSubGroup ensures GT/E12 is in correct subgroup func (z *E12) IsInSubGroup() bool { {{- if eq .Curve.Name "bn254"}} var a, b, _b E12 diff --git a/internal/generator/tower/template/fq12over6over2/fq2.go.tmpl b/internal/generator/tower/template/fq12over6over2/fq2.go.tmpl index c790420211..68b33f07da 100644 --- a/internal/generator/tower/template/fq12over6over2/fq2.go.tmpl +++ b/internal/generator/tower/template/fq12over6over2/fq2.go.tmpl @@ -20,7 +20,7 @@ func (z *E2) Bits() E2 { r := E2 {} r.A0 = z.A0.Bits() r.A1 = z.A1.Bits() - return r + return r } @@ -202,7 +202,7 @@ func (z *E2) Exp(x E2, k *big.Int) *E2 { var sqrtExp1, sqrtExp2 big.Int // Sqrt sets z to the square root of and returns z - // The function does not test wether the square root + // The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 9) @@ -232,7 +232,7 @@ func (z *E2) Exp(x E2, k *big.Int) *E2 { } {{else }} // Sqrt sets z to the square root of and returns z - // The function does not test wether the square root + // The function does not test whether the square root // exists or not, it's up to the caller to call // Legendre beforehand. // cf https://eprint.iacr.org/2012/685.pdf (algo 10) diff --git a/internal/generator/tower/template/fq12over6over2/fq6.go.tmpl b/internal/generator/tower/template/fq12over6over2/fq6.go.tmpl index 347f00f378..621a577016 100644 --- a/internal/generator/tower/template/fq12over6over2/fq6.go.tmpl +++ b/internal/generator/tower/template/fq12over6over2/fq6.go.tmpl @@ -3,7 +3,7 @@ type E6 struct { B0, B1, B2 E2 } -// Equal returns true if z equals x, fasle otherwise +// Equal returns true if z equals x, false otherwise func (z *E6) Equal(x *E6) bool { return z.B0.Equal(&x.B0) && z.B1.Equal(&x.B1) && z.B2.Equal(&x.B2) }