fields_bn254

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation ΒΆ

Overview ΒΆ

Package fields_bn254 implements the fields arithmetic of the direct 𝔽pΒΉΒ² extension used to compute the pairing over the BN254 curve.

𝔽pΒΉΒ²[i] = 𝔽p/iΒΉΒ²-18i⁢+82

This direct tower is isomorphic to the 2-3-2 tower:

𝔽pΒ²[u] = 𝔽p/uΒ²+1
𝔽p⁢[v] = 𝔽pΒ²/vΒ³-9-u
𝔽pΒΉΒ²[w] = 𝔽p⁢/wΒ²-v

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func GetHints ΒΆ

func GetHints() []solver.Hint

GetHints returns all hint functions used in the package.

Types ΒΆ

type E12 ΒΆ

type E12 struct {
	A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11 baseEl
}

func FromE12 ΒΆ

func FromE12(a *bn254.E12) E12

tower to direct extension conversion

type E2 ΒΆ

type E2 struct {
	A0, A1 baseEl
}

func FromE2 ΒΆ

func FromE2(y *bn254.E2) E2

type Ext12 ΒΆ

type Ext12 struct {
	*Ext2
	// contains filtered or unexported fields
}

func NewExt12 ΒΆ

func NewExt12(api frontend.API) *Ext12

func (Ext12) Add ΒΆ

func (e Ext12) Add(x, y *E12) *E12

func (Ext12) AssertIsEqual ΒΆ

func (e Ext12) AssertIsEqual(a, b *E12)

func (Ext12) Conjugate ΒΆ

func (e Ext12) Conjugate(x *E12) *E12

func (Ext12) Copy ΒΆ added in v0.12.0

func (e Ext12) Copy(x *E12) *E12

func (Ext12) CyclotomicSquareGS ΒΆ added in v0.12.0

func (e Ext12) CyclotomicSquareGS(x *E12) *E12

Granger-Scott's cyclotomic square https://eprint.iacr.org/2009/565.pdf, 3.2

func (Ext12) DivUnchecked ΒΆ

func (e Ext12) DivUnchecked(x, y *E12) *E12

func (Ext12) Double ΒΆ added in v0.12.0

func (e Ext12) Double(x *E12) *E12

func (Ext12) ExpByU ΒΆ added in v0.11.0

func (e Ext12) ExpByU(x *E12) *E12

Exponentiation by U=6u+2 where t is the seed u=4965661367192848881

func (Ext12) Expt ΒΆ added in v0.12.0

func (e Ext12) Expt(x *E12) *E12

Exponentiation by the seed t=4965661367192848881

func (Ext12) Frobenius ΒΆ added in v0.11.0

func (e Ext12) Frobenius(a *E12) *E12

func (Ext12) FrobeniusCube ΒΆ added in v0.11.0

func (e Ext12) FrobeniusCube(a *E12) *E12

func (Ext12) FrobeniusSquare ΒΆ added in v0.11.0

func (e Ext12) FrobeniusSquare(a *E12) *E12

func (Ext12) FromTower ΒΆ added in v0.12.0

func (e Ext12) FromTower(tower [12]*baseEl) *E12

func (Ext12) Inverse ΒΆ

func (e Ext12) Inverse(x *E12) *E12

func (Ext12) IsEqual ΒΆ added in v0.11.0

func (e Ext12) IsEqual(x, y *E12) frontend.Variable

func (Ext12) Mul ΒΆ

func (e Ext12) Mul(x, y *E12) *E12

func (*Ext12) Mul01379By01379 ΒΆ added in v0.12.0

func (e *Ext12) Mul01379By01379(e3, e4, c3, c4 *E2) [10]*baseEl

Mul01379By01379 multiplies two E12 sparse element of the form:

A0  =  1
A1  =  c3.A0 - 9 * c3.A1
A2  =  0
A3  =  c4.A0 - 9 * c4.A1
A4  =  0
A5  =  0
A6  =  0
A7  =  c3.A1
A8  =  0
A9  =  c4.A1
A10 =  0
A11 =  0

func (*Ext12) MulBy012346789 ΒΆ added in v0.12.0

func (e *Ext12) MulBy012346789(a *E12, b [10]*baseEl) *E12

MulBy012346789 multiplies a by an E12 sparse element b of the form

b.A0  =  b[0]
b.A1  =  b[1]
b.A2  =  b[2]
b.A3  =  b[3]
b.A4  =  b[4]
b.A5  =  0
b.A6  =  b[5]
b.A7  =  b[6]
b.A8  =  b[7]
b.A9  =  b[8]
b.A10 =  b[9]
b.A11 =  0

func (*Ext12) MulBy01379 ΒΆ added in v0.12.0

func (e *Ext12) MulBy01379(a *E12, c3, c4 *E2) *E12

MulBy01379 multiplies a by an E12 sparse element b of the form

b.A0  =  1
b.A1  =  c3.A0 - 9 * c3.A1
b.A2  =  0
b.A3  =  c4.A0 - 9 * c4.A1
b.A4  =  0
b.A5  =  0
b.A6  =  0
b.A7  =  c3.A1
b.A8  =  0
b.A9  =  c4.A1
b.A10 =  0
b.A11 =  0

func (Ext12) Neg ΒΆ added in v0.12.0

func (e Ext12) Neg(x *E12) *E12

func (Ext12) One ΒΆ

func (e Ext12) One() *E12

func (Ext12) Square ΒΆ

func (e Ext12) Square(x *E12) *E12

func (Ext12) Sub ΒΆ

func (e Ext12) Sub(x, y *E12) *E12

func (Ext12) ToTower ΒΆ added in v0.12.0

func (e Ext12) ToTower(a *E12) [12]*baseEl

func (Ext12) Zero ΒΆ

func (e Ext12) Zero() *E12

type Ext2 ΒΆ

type Ext2 struct {
	// contains filtered or unexported fields
}

func NewExt2 ΒΆ

func NewExt2(api frontend.API) *Ext2

func (Ext2) Add ΒΆ

func (e Ext2) Add(x, y *E2) *E2

func (Ext2) AssertIsEqual ΒΆ

func (e Ext2) AssertIsEqual(x, y *E2)

func (Ext2) Conjugate ΒΆ

func (e Ext2) Conjugate(x *E2) *E2

func (Ext2) Cube ΒΆ added in v0.12.0

func (e Ext2) Cube(x *E2) *E2

func (Ext2) DivUnchecked ΒΆ

func (e Ext2) DivUnchecked(x, y *E2) *E2

func (Ext2) Double ΒΆ

func (e Ext2) Double(x *E2) *E2

func (Ext2) Inverse ΒΆ

func (e Ext2) Inverse(x *E2) *E2

func (Ext2) IsEqual ΒΆ added in v0.11.0

func (e Ext2) IsEqual(x, y *E2) frontend.Variable

func (Ext2) IsZero ΒΆ

func (e Ext2) IsZero(z *E2) frontend.Variable

func (Ext2) Lookup2 ΒΆ

func (e Ext2) Lookup2(s1, s2 frontend.Variable, a, b, c, d *E2) *E2

func (Ext2) Mul ΒΆ

func (e Ext2) Mul(x, y *E2) *E2

func (Ext2) MulByConstElement ΒΆ

func (e Ext2) MulByConstElement(x *E2, y *big.Int) *E2

func (Ext2) MulByElement ΒΆ

func (e Ext2) MulByElement(x *E2, y *baseEl) *E2

func (Ext2) MulByNonResidue ΒΆ

func (e Ext2) MulByNonResidue(x *E2) *E2

MulByNonResidue return x*(9+u)

func (Ext2) MulByNonResidue1Power1 ΒΆ

func (e Ext2) MulByNonResidue1Power1(x *E2) *E2

MulByNonResidue1Power1 returns x*(9+u)^(1*(p^1-1)/6)

func (Ext2) MulByNonResidue1Power2 ΒΆ

func (e Ext2) MulByNonResidue1Power2(x *E2) *E2

MulByNonResidue1Power2 returns x*(9+u)^(2*(p^1-1)/6)

func (Ext2) MulByNonResidue1Power3 ΒΆ

func (e Ext2) MulByNonResidue1Power3(x *E2) *E2

MulByNonResidue1Power3 returns x*(9+u)^(3*(p^1-1)/6)

func (Ext2) MulByNonResidue1Power4 ΒΆ

func (e Ext2) MulByNonResidue1Power4(x *E2) *E2

MulByNonResidue1Power4 returns x*(9+u)^(4*(p^1-1)/6)

func (Ext2) MulByNonResidue1Power5 ΒΆ

func (e Ext2) MulByNonResidue1Power5(x *E2) *E2

MulByNonResidue1Power5 returns x*(9+u)^(5*(p^1-1)/6)

func (Ext2) MulByNonResidue2Power1 ΒΆ

func (e Ext2) MulByNonResidue2Power1(x *E2) *E2

MulByNonResidue2Power1 returns x*(9+u)^(1*(p^2-1)/6)

func (Ext2) MulByNonResidue2Power2 ΒΆ

func (e Ext2) MulByNonResidue2Power2(x *E2) *E2

MulByNonResidue2Power2 returns x*(9+u)^(2*(p^2-1)/6)

func (Ext2) MulByNonResidue2Power3 ΒΆ

func (e Ext2) MulByNonResidue2Power3(x *E2) *E2

MulByNonResidue2Power3 returns x*(9+u)^(3*(p^2-1)/6)

func (Ext2) MulByNonResidue2Power4 ΒΆ

func (e Ext2) MulByNonResidue2Power4(x *E2) *E2

MulByNonResidue2Power4 returns x*(9+u)^(4*(p^2-1)/6)

func (Ext2) MulByNonResidue2Power5 ΒΆ

func (e Ext2) MulByNonResidue2Power5(x *E2) *E2

MulByNonResidue2Power5 returns x*(9+u)^(5*(p^2-1)/6)

func (Ext2) MulByNonResidue3Power1 ΒΆ

func (e Ext2) MulByNonResidue3Power1(x *E2) *E2

MulByNonResidue3Power1 returns x*(9+u)^(1*(p^3-1)/6)

func (Ext2) MulByNonResidue3Power2 ΒΆ

func (e Ext2) MulByNonResidue3Power2(x *E2) *E2

MulByNonResidue3Power2 returns x*(9+u)^(2*(p^3-1)/6)

func (Ext2) MulByNonResidue3Power3 ΒΆ

func (e Ext2) MulByNonResidue3Power3(x *E2) *E2

MulByNonResidue3Power3 returns x*(9+u)^(3*(p^3-1)/6)

func (Ext2) MulByNonResidue3Power4 ΒΆ

func (e Ext2) MulByNonResidue3Power4(x *E2) *E2

MulByNonResidue3Power4 returns x*(9+u)^(4*(p^3-1)/6)

func (Ext2) MulByNonResidue3Power5 ΒΆ

func (e Ext2) MulByNonResidue3Power5(x *E2) *E2

MulByNonResidue3Power5 returns x*(9+u)^(5*(p^3-1)/6)

func (Ext2) MulByNonResidueGeneric ΒΆ

func (e Ext2) MulByNonResidueGeneric(x *E2, power, coef int) *E2

func (Ext2) Neg ΒΆ

func (e Ext2) Neg(x *E2) *E2

func (Ext2) One ΒΆ

func (e Ext2) One() *E2

func (Ext2) Select ΒΆ

func (e Ext2) Select(selector frontend.Variable, z1, z0 *E2) *E2

func (Ext2) Square ΒΆ

func (e Ext2) Square(x *E2) *E2

func (Ext2) Sub ΒΆ

func (e Ext2) Sub(x, y *E2) *E2

func (Ext2) Zero ΒΆ

func (e Ext2) Zero() *E2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL