fields_bls12377

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fields_bls12377 implements the fields arithmetic of the Fp12 tower used to compute the pairing over the BLS12-377 curve.

𝔽p²[u] = 𝔽p/u²+5
𝔽p⁶[v] = 𝔽p²/v³-u
𝔽p¹²[w] = 𝔽p⁶/w²-v

Reference: https://eprint.iacr.org/2022/1162

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHints

func GetHints() []solver.Hint

func Mul034By034

func Mul034By034(api frontend.API, d3, d4, c3, c4 E2) *[5]E2

Mul034By034 multiplication of sparse element (1,0,0,c3,c4,0) by sparse element (1,0,0,d3,d4,0)

Types

type E12

type E12 struct {
	C0, C1 E6
}

E12 element in a quadratic extension

func Mul01234By034

func Mul01234By034(api frontend.API, x [5]E2, z3, z4 E2) *E12

func (*E12) Add

func (e *E12) Add(api frontend.API, e1, e2 E12) *E12

Add adds 2 elmts in Fp12

func (*E12) AssertIsEqual

func (e *E12) AssertIsEqual(api frontend.API, other E12)

AssertIsEqual constraint self to be equal to other into the given constraint system

func (*E12) Assign

func (e *E12) Assign(a *bls12377.E12)

Assign a value to self (witness assignment)

func (*E12) Conjugate

func (e *E12) Conjugate(api frontend.API, e1 E12) *E12

Conjugate applies Frob**6 (conjugation over Fp6)

func (*E12) CyclotomicSquare

func (e *E12) CyclotomicSquare(api frontend.API, x E12) *E12

Granger-Scott's cyclotomic square squares a Fp12 elt in the cyclotomic group https://eprint.iacr.org/2009/565.pdf, 3.2

func (*E12) CyclotomicSquareKarabina12345

func (e *E12) CyclotomicSquareKarabina12345(api frontend.API, x E12) *E12

func (*E12) CyclotomicSquareKarabina2345

func (e *E12) CyclotomicSquareKarabina2345(api frontend.API, x E12) *E12

Karabina's compressed cyclotomic square https://eprint.iacr.org/2010/542.pdf Th. 3.2 with minor modifications to fit our tower

func (*E12) DecompressKarabina12345

func (e *E12) DecompressKarabina12345(api frontend.API, x E12) *E12

DecompressKarabina12345 Karabina's cyclotomic square result SQR12345

func (*E12) DecompressKarabina2345

func (e *E12) DecompressKarabina2345(api frontend.API, x E12) *E12

DecompressKarabina2345 Karabina's cyclotomic square result SQR2345

func (*E12) DivUnchecked

func (e *E12) DivUnchecked(api frontend.API, e1, e2 E12) *E12

DivUnchecked e12 elmts

func (*E12) ExpX0

func (e *E12) ExpX0(api frontend.API, e1 E12) *E12

ExpX0 compute e1^X0, where X0=9586122913090633729

func (*E12) ExpX0Minus1Square

func (e *E12) ExpX0Minus1Square(api frontend.API, e1 E12) *E12

ExpX0Minus1Square computes e1^((X0-1)^2), where X0=9586122913090633729

func (*E12) Frobenius

func (e *E12) Frobenius(api frontend.API, e1 E12) *E12

Frobenius applies frob to an fp12 elmt

func (*E12) FrobeniusSquare

func (e *E12) FrobeniusSquare(api frontend.API, e1 E12) *E12

FrobeniusSquare applies frob**2 to an fp12 elmt

func (*E12) Inverse

func (e *E12) Inverse(api frontend.API, e1 E12) *E12

Inverse e12 elmts

func (*E12) Mul

func (e *E12) Mul(api frontend.API, e1, e2 E12) *E12

Mul multiplies 2 elmts in Fp12

func (*E12) MulBy01234

func (e *E12) MulBy01234(api frontend.API, x [5]E2) *E12

func (*E12) MulBy034

func (e *E12) MulBy034(api frontend.API, c3, c4 E2) *E12

MulBy034 multiplication by sparse element

func (*E12) Neg

func (e *E12) Neg(api frontend.API, e1 E12) *E12

Neg negates an Fp6elmt

func (*E12) Select

func (e *E12) Select(api frontend.API, b frontend.Variable, r1, r2 E12) *E12

Select sets e to r1 if b=1, r2 otherwise

func (*E12) SetOne

func (e *E12) SetOne() *E12

SetOne returns a newly allocated element equal to 1

func (*E12) SetZero

func (e *E12) SetZero() *E12

SetZero returns a newly allocated element equal to 0

func (*E12) Square

func (e *E12) Square(api frontend.API, x E12) *E12

Square squares an element in Fp12

func (*E12) Square034

func (e *E12) Square034(api frontend.API, x E12) *E12

Square034 squares a sparse element in Fp12

func (*E12) Sub

func (e *E12) Sub(api frontend.API, e1, e2 E12) *E12

Sub substracts 2 elmts in Fp12

type E2

type E2 struct {
	A0, A1 frontend.Variable
}

E2 element in a quadratic extension

func (*E2) Add

func (e *E2) Add(api frontend.API, e1, e2 E2) *E2

Add e2 elmts

func (*E2) AssertIsEqual

func (e *E2) AssertIsEqual(api frontend.API, other E2)

AssertIsEqual constraint self to be equal to other into the given constraint system

func (*E2) Assign

func (e *E2) Assign(a *bls12377.E2)

Assign a value to self (witness assignment)

func (*E2) Conjugate

func (e *E2) Conjugate(api frontend.API, e1 E2) *E2

Conjugate conjugation of an e2 elmt

func (*E2) DivUnchecked

func (e *E2) DivUnchecked(api frontend.API, e1, e2 E2) *E2

DivUnchecked e2 elmts

func (*E2) Double

func (e *E2) Double(api frontend.API, e1 E2) *E2

Double e2 elmt

func (*E2) Inverse

func (e *E2) Inverse(api frontend.API, e1 E2) *E2

Inverse e2 elmts

func (*E2) IsZero

func (e *E2) IsZero(api frontend.API) frontend.Variable

IsZero returns 1 if the element is equal to 0 and 0 otherwise

func (*E2) Lookup2

func (e *E2) Lookup2(api frontend.API, b1, b2 frontend.Variable, r1, r2, r3, r4 E2) *E2

Lookup2 implements two-bit lookup. It returns:

  • r1 if b1=0 and b2=0,
  • r2 if b1=0 and b2=1,
  • r3 if b1=1 and b2=0,
  • r3 if b1=1 and b2=1.

func (*E2) Mul

func (e *E2) Mul(api frontend.API, e1, e2 E2) *E2

Mul e2 elmts

func (*E2) MulByFp

func (e *E2) MulByFp(api frontend.API, e1 E2, c interface{}) *E2

MulByFp multiplies an fp2 elmt by an fp elmt

func (*E2) MulByNonResidue

func (e *E2) MulByNonResidue(api frontend.API, e1 E2) *E2

MulByNonResidue multiplies an fp2 elmt by the imaginary elmt ext.uSquare is the square of the imaginary root

func (*E2) Neg

func (e *E2) Neg(api frontend.API, e1 E2) *E2

Neg negates a e2 elmt

func (*E2) Select

func (e *E2) Select(api frontend.API, b frontend.Variable, r1, r2 E2) *E2

Select sets e to r1 if b=1, r2 otherwise

func (*E2) SetOne

func (e *E2) SetOne() *E2

SetOne returns a newly allocated element equal to 1

func (*E2) SetZero

func (e *E2) SetZero() *E2

SetZero returns a newly allocated element equal to 0

func (*E2) Square

func (e *E2) Square(api frontend.API, x E2) *E2

Square e2 elt

func (*E2) Sub

func (e *E2) Sub(api frontend.API, e1, e2 E2) *E2

Sub e2 elmts

type E6

type E6 struct {
	B0, B1, B2 E2
}

E6 element in a quadratic extension

func Mul01By01

func Mul01By01(api frontend.API, c0, c1, d0, d1 E2) *E6

func NewFp6Zero

func NewFp6Zero(api frontend.API) *E6

NewFp6Zero creates a new

func (*E6) Add

func (e *E6) Add(api frontend.API, e1, e2 E6) *E6

Add creates a fp6elmt from fp elmts

func (*E6) AssertIsEqual

func (e *E6) AssertIsEqual(api frontend.API, other E6)

AssertIsEqual constraint self to be equal to other into the given constraint system

func (*E6) Assign

func (e *E6) Assign(a *bls12377.E6)

Assign a value to self (witness assignment)

func (*E6) DivUnchecked

func (e *E6) DivUnchecked(api frontend.API, e1, e2 E6) *E6

DivUnchecked e6 elmts

func (*E6) Double

func (e *E6) Double(api frontend.API, e1 E6) *E6

Double e6 elmt

func (*E6) Inverse

func (e *E6) Inverse(api frontend.API, e1 E6) *E6

Inverse e6 elmts

func (*E6) Mul

func (e *E6) Mul(api frontend.API, e1, e2 E6) *E6

Mul creates a fp6elmt from fp elmts icube is the imaginary elmt to the cube

func (*E6) Mul0By01

func (e *E6) Mul0By01(api frontend.API, a0, b0, b1 E2) *E6

func (*E6) MulBy01

func (e *E6) MulBy01(api frontend.API, c0, c1 E2) *E6

MulBy01 multiplication by sparse element (c0,c1,0)

func (*E6) MulByE2

func (e *E6) MulByE2(api frontend.API, e1 E6, e2 E2) *E6

MulByE2 multiplies an element in E6 by an element in E2

func (*E6) MulByFp2

func (e *E6) MulByFp2(api frontend.API, e1 E6, e2 E2) *E6

MulByFp2 creates a fp6elmt from fp elmts icube is the imaginary elmt to the cube

func (*E6) MulByNonResidue

func (e *E6) MulByNonResidue(api frontend.API, e1 E6) *E6

MulByNonResidue multiplies e by the imaginary elmt of Fp6 (noted a+bV+cV where V**3 in F²)

func (*E6) Neg

func (e *E6) Neg(api frontend.API, e1 E6) *E6

Neg negates an Fp6 elmt

func (*E6) Select

func (e *E6) Select(api frontend.API, b frontend.Variable, r1, r2 E6) *E6

Select sets e to r1 if b=1, r2 otherwise

func (*E6) SetOne

func (e *E6) SetOne() *E6

SetOne returns a newly allocated element equal to 1

func (*E6) SetZero

func (e *E6) SetZero() *E6

SetZero returns a newly allocated element equal to 0

func (*E6) Square

func (e *E6) Square(api frontend.API, x E6) *E6

Square sets z to the E6 product of x,x, returns e

func (*E6) Sub

func (e *E6) Sub(api frontend.API, e1, e2 E6) *E6

Sub creates a fp6elmt from fp elmts

type Extension

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

Extension stores the non residue elmt for an extension of type Fp->Fp2->Fp6->Fp12 (Fp2 = Fp(u), Fp6 = Fp2(v), Fp12 = Fp6(w))

Jump to

Keyboard shortcuts

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