sw

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LineEvalAffineBLS377

func LineEvalAffineBLS377(cs *frontend.ConstraintSystem, Q, R G2Affine, P G1Affine, result *LineEvalRes, ext fields.Extension)

LineEvalAffineBLS377 computes f(P) where div(f) = (P)+(R)+(-(P+R))-3O, Q, R are on the twist and in the r-torsion (trace 0 subgroup) the result is pulled back like if it was computed on the original curve, so it's a Fp12Elmt, that is sparse, only 3 entries are non zero. The result is therefore stored in a custom type LineEvalRes representing a sparse element

func LineEvalBLS377

func LineEvalBLS377(cs *frontend.ConstraintSystem, Q, R G2Jac, P G1Jac, result *LineEvalRes, ext fields.Extension)

LineEvalBLS377 computes f(P) where div(f) = (P)+(R)+(-(P+R))-3O, Q, R are on the twist and in the r-torsion (trace 0 subgroup) the result is pulled back like if it was computed on the original curve, so it's a Fp12Elmt, that is sparse, only 3 entries are non zero. The result is therefore stored in a custom type LineEvalRes representing a sparse element

func MillerLoop

func MillerLoop(cs *frontend.ConstraintSystem, P G1Jac, Q G2Jac, res *fields.E12, pairingInfo PairingContext) *fields.E12

MillerLoop computes the miller loop

func MillerLoopAffine

func MillerLoopAffine(cs *frontend.ConstraintSystem, P G1Affine, Q G2Affine, res *fields.E12, pairingInfo PairingContext) *fields.E12

MillerLoopAffine computes the miller loop, with points in affine When neither Q nor P are the point at infinity

Types

type G1Affine

type G1Affine struct {
	X, Y frontend.Variable
}

G1Affine point in affine coords

func (*G1Affine) AddAssign

func (p *G1Affine) AddAssign(cs *frontend.ConstraintSystem, p1 *G1Affine) *G1Affine

AddAssign adds p1 to p using the affine formulas with division, and return p

func (*G1Affine) Assign

func (p *G1Affine) Assign(p1 *bls377.G1Affine)

Assign a value to self (witness assignment)

func (*G1Affine) AssignToRefactor

func (p *G1Affine) AssignToRefactor(cs *frontend.ConstraintSystem, p1 *G1Affine) *G1Affine

AssignToRefactor sets p to p1 and return it

func (*G1Affine) Double

func (p *G1Affine) Double(cs *frontend.ConstraintSystem, p1 *G1Affine) *G1Affine

Double double a point in affine coords

func (*G1Affine) FromJac

func (p *G1Affine) FromJac(cs *frontend.ConstraintSystem, p1 *G1Jac) *G1Affine

FromJac sets p to p1 in affine and returns it

func (*G1Affine) MustBeEqual

func (p *G1Affine) MustBeEqual(cs *frontend.ConstraintSystem, other G1Affine)

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

func (*G1Affine) Neg

Neg outputs -p

func (*G1Affine) ScalarMul

func (p *G1Affine) ScalarMul(cs *frontend.ConstraintSystem, p1 *G1Affine, s interface{}, n int) *G1Affine

ScalarMul computes scalar*p1, affect the result to p, and returns it. n is the number of bits used for the scalar mul. TODO it doesn't work if the scalar if 1, because it ends up doing P-P at the end, involving division by 0 TODO add a panic if scalar == 1

func (*G1Affine) Select

func (p *G1Affine) Select(cs *frontend.ConstraintSystem, b frontend.Variable, p1, p2 *G1Affine) *G1Affine

Select sets p1 if b=1, p2 if b=0, and returns it. b must be boolean constrained

type G1Jac

type G1Jac struct {
	X, Y, Z frontend.Variable
}

G1Jac point in Jacobian coords

func (*G1Jac) AddAssign

func (p *G1Jac) AddAssign(cs *frontend.ConstraintSystem, p1 *G1Jac) *G1Jac

AddAssign adds 2 point in Jacobian coordinates p=p, a=p1

func (*G1Jac) Assign

func (p *G1Jac) Assign(p1 *bls377.G1Jac)

Assign a value to self (witness assignment)

func (*G1Jac) AssignToRefactor

func (p *G1Jac) AssignToRefactor(cs *frontend.ConstraintSystem, p1 *G1Jac) *G1Jac

AssignToRefactor sets p to p1 and return it

func (*G1Jac) DoubleAssign

func (p *G1Jac) DoubleAssign(cs *frontend.ConstraintSystem) *G1Jac

DoubleAssign doubles the receiver point in jacobian coords and returns it

func (*G1Jac) MustBeEqual

func (p *G1Jac) MustBeEqual(cs *frontend.ConstraintSystem, other G1Jac)

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

func (*G1Jac) Neg

func (p *G1Jac) Neg(cs *frontend.ConstraintSystem, p1 *G1Jac) *G1Jac

Neg outputs -p

type G2Affine

type G2Affine struct {
	X, Y fields.E2
}

G2Affine point in affine coords

func (*G2Affine) AddAssign

func (p *G2Affine) AddAssign(cs *frontend.ConstraintSystem, p1 *G2Affine, ext fields.Extension) *G2Affine

AddAssign add p1 to p and return p

func (*G2Affine) Assign

func (p *G2Affine) Assign(p1 *bls377.G2Affine)

Assign a value to self (witness assignment)

func (*G2Affine) Double

Double compute 2*p1, assign the result to p and return it Only for curve with j invariant 0 (a=0).

func (*G2Affine) MustBeEqual

func (p *G2Affine) MustBeEqual(cs *frontend.ConstraintSystem, other G2Affine)

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

func (*G2Affine) Neg

Neg outputs -p

type G2Jac

type G2Jac struct {
	X, Y, Z fields.E2
}

G2Jac point in Jacobian coords

func (*G2Jac) AddAssign

func (p *G2Jac) AddAssign(cs *frontend.ConstraintSystem, p1 *G2Jac, ext fields.Extension) *G2Jac

AddAssign adds 2 point in Jacobian coordinates p=p, a=p1

func (*G2Jac) Assign

func (p *G2Jac) Assign(p1 *bls377.G2Jac)

Assign a value to self (witness assignment)

func (*G2Jac) Double

func (p *G2Jac) Double(cs *frontend.ConstraintSystem, p1 *G2Jac, ext fields.Extension) *G2Jac

Double doubles a point in jacobian coords

func (*G2Jac) MustBeEqual

func (p *G2Jac) MustBeEqual(cs *frontend.ConstraintSystem, other G2Jac)

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

func (*G2Jac) Neg

func (p *G2Jac) Neg(cs *frontend.ConstraintSystem, p1 *G2Jac) *G2Jac

Neg outputs -p

func (*G2Jac) ToProj

func (p *G2Jac) ToProj(cs *frontend.ConstraintSystem, p1 *G2Jac, ext fields.Extension) *G2Jac

ToProj sets p to p1 in projective coords and return it

type LineEvalRes

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

LineEvalRes represents a sparse Fp12 Elmt (result of the line evaluation)

func (*LineEvalRes) MulAssign

func (l *LineEvalRes) MulAssign(cs *frontend.ConstraintSystem, z *fields.E12, ext fields.Extension)

MulAssign multiplies the result of a line evaluation to the current Fp12 accumulator

type PairingContext

type PairingContext struct {
	AteLoop   uint64 // stores the ate loop
	Extension fields.Extension
}

PairingContext contains useful info about the pairing

Jump to

Keyboard shortcuts

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