fields_bls24315

package
v0.0.0-...-4c0a751 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fields_bls24315 implements the fields arithmetic of the Fp24 tower used to compute the pairing over the BLS24-315 curve.

𝔽p²[u] = 𝔽p/u²-13
𝔽p⁴[v] = 𝔽p²/v²-u
𝔽p¹²[w] = 𝔽p⁴/w³-v
𝔽p²⁴[i] = 𝔽p¹²/i²-w

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 E4) *[5]E4

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, C2 E4
}

E12 element in a quadratic extension

func NewFp12Zero

func NewFp12Zero(api frontend.API) *E12

NewFp12Zero creates a new

func (*E12) Add

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

Add creates a fp12elmt from fp elmts

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 *bls24315.E12)

Assign a value to self (witness assignment)

func (*E12) DivUnchecked

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

DivUnchecked e12 elmts

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 creates a fp12elmt from fp elmts icube is the imaginary elmt to the cube

func (*E12) Mul0By01

func (e *E12) Mul0By01(api frontend.API, a0, b0, b1 E4) *E12

func (*E12) MulBy01

func (e *E12) MulBy01(api frontend.API, c0, c1 E4) *E12

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

func (*E12) MulByE4

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

MulByE4 multiplies an element in E12 by an element in E4

func (*E12) MulByFp2

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

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

func (*E12) MulByNonResidue

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

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

func (*E12) Neg

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

Neg negates an Fp12 elmt

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 sets z to the E12 product of x,x, returns e

func (*E12) Sub

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

Sub creates a fp12elmt from fp elmts

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 *bls24315.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: 5C

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 E24

type E24 struct {
	D0, D1 E12
}

E24 element in a quadratic extension

func (*E24) Add

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

Add adds 2 elmts in Fp24

func (*E24) AssertIsEqual

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

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

func (*E24) Assign

func (e *E24) Assign(a *bls24315.E24)

Assign a value to self (witness assignment)

func (*E24) Conjugate

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

Conjugate applies Frob**6 (conjugation over Fp6)

func (*E24) CyclotomicSquare

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

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

func (*E24) CyclotomicSquareKarabina2345

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

Karabina's compressed cyclotomic square https://eprint.iacr.org/2010/542.pdf

func (*E24) DecompressKarabina2345

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

DecompressKarabina2345 Karabina's cyclotomic square result

func (*E24) DivUnchecked

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

DivUnchecked e24 elmts

func (*E24) Expt

func (e *E24) Expt(api frontend.API, x E24) *E24

Expt compute e1**exponent, where the exponent is hardcoded This function is only used for the final expo of the pairing for bls24315, so the exponent is supposed to be hardcoded and on 32 bits.

func (*E24) Frobenius

func (e *E24) Frobenius(api frontend.API, x E24) *E24

Frobenius applies frob to an fp24 elmt

func (*E24) FrobeniusQuad

func (e *E24) FrobeniusQuad(api frontend.API, x E24) *E24

FrobeniusQuad applies frob**4 to an fp24 elmt

func (*E24) FrobeniusSquare

func (e *E24) FrobeniusSquare(api frontend.API, x E24) *E24

FrobeniusSquare applies frob**2 to an fp24 elmt

func (*E24) Inverse

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

Inverse e24 elmts

func (*E24) Mul

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

Mul multiplies 2 elmts in Fp24

func (*E24) MulBy034

func (e *E24) MulBy034(api frontend.API, c3, c4 E4) *E24

MulBy034 multiplication by sparse element

func (*E24) Neg

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

Neg negates an Fp6elmt

func (*E24) SetOne

func (e *E24) SetOne() *E24

SetOne returns a newly allocated element equal to 1

func (*E24) SetZero

func (e *E24) SetZero() *E24

SetZero returns a newly allocated element equal to 0

func (*E24) Square

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

Square squares an element in Fp24

func (*E24) Square034

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

Square034 squares a sparse element in Fp24

func (*E24) Sub

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

Sub subtracts 2 elmts in Fp24

type E4

type E4 struct {
	B0, B1 E2
}

E4 element in a quadratic extension

func NewFp4Zero

func NewFp4Zero(api frontend.API) *E4

NewFp4Zero creates a new

func (*E4) Add

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

Add e4 elmts

func (*E4) AssertIsEqual

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

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

func (*E4) Assign

func (e *E4) Assign(a *bls24315.E4)

Assign a value to self (witness assignment)

func (*E4) Conjugate

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

Conjugate conjugation of an e4 elmt

func (*E4) DivUnchecked

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

DivUnchecked e4 elmts

func (*E4) Double

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

Double e4 elmt

func (*E4) Inverse

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

Inverse e4 elmts

func (*E4) IsZero

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

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

func (*E4) Lookup2

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

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 (*E4) Mul

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

Mul e4 elmts: 5C

func (*E4) MulByFp

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

MulByFp multiplies an e4 elmt by an fp elmt

func (*E4) MulByNonResidue

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

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

func (*E4) Neg

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

Neg negates a e4 elmt

func (*E4) Select

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

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

func (*E4) SetOne

func (e *E4) SetOne() *E4

SetOne returns a newly allocated element equal to 1

func (*E4) SetZero

func (e *E4) SetZero() *E4

SetZero returns a newly allocated element equal to 0

func (*E4) Square

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

Square e4 elt

func (*E4) Sub

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

Sub e4 elmts

type Extension

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

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

Jump to

Keyboard shortcuts

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