Documentation ¶
Overview ¶
Package sw (short weierstrass)
Index ¶
- Variables
- func DoubleAndAddStep(api frontend.API, p1, p2 *G2Affine) (G2Affine, LineEvaluation, LineEvaluation)
- func DoubleStep(api frontend.API, p1 *G2Affine) (G2Affine, LineEvaluation)
- type G1Affine
- func (p *G1Affine) AddAssign(api frontend.API, p1 G1Affine) *G1Affine
- func (p *G1Affine) AssertIsEqual(api frontend.API, other G1Affine)
- func (p *G1Affine) Assign(p1 *bls12377.G1Affine)
- func (p *G1Affine) Double(api frontend.API, p1 G1Affine) *G1Affine
- func (p *G1Affine) DoubleAndAdd(api frontend.API, p1, p2 *G1Affine) *G1Affine
- func (p *G1Affine) FromJac(api frontend.API, p1 G1Jac) *G1Affine
- func (p *G1Affine) Neg(api frontend.API, p1 G1Affine) *G1Affine
- func (P *G1Affine) ScalarMul(api frontend.API, Q G1Affine, s interface{}) *G1Affine
- func (p *G1Affine) Select(api frontend.API, b frontend.Variable, p1, p2 G1Affine) *G1Affine
- type G1Jac
- type G2Affine
- func (p *G2Affine) AddAssign(api frontend.API, p1 G2Affine) *G2Affine
- func (p *G2Affine) AssertIsEqual(api frontend.API, other G2Affine)
- func (p *G2Affine) Assign(p1 *bls12377.G2Affine)
- func (p *G2Affine) Double(api frontend.API, p1 G2Affine) *G2Affine
- func (p *G2Affine) DoubleAndAdd(api frontend.API, p1, p2 *G2Affine) *G2Affine
- func (p *G2Affine) FromJac(api frontend.API, p1 G2Jac) *G2Affine
- func (p *G2Affine) Neg(api frontend.API, p1 G2Affine) *G2Affine
- func (P *G2Affine) ScalarMul(api frontend.API, Q G2Affine, s interface{}) *G2Affine
- func (p *G2Affine) Select(api frontend.API, b frontend.Variable, p1, p2 G2Affine) *G2Affine
- type G2Jac
- type GT
- type LineEvaluation
Constants ¶
This section is empty.
Variables ¶
var DecomposeScalarG1 = func(scalarField *big.Int, inputs []*big.Int, res []*big.Int) error { cc := getInnerCurveConfig(scalarField) sp := ecc.SplitScalar(inputs[0], cc.glvBasis) res[0].Set(&(sp[0])) res[1].Set(&(sp[1])) one := big.NewInt(1) for res[0].Cmp(cc.lambda) < 1 && res[1].Cmp(cc.lambda) < 1 { res[0].Add(res[0], cc.lambda) res[0].Add(res[0], one) res[1].Add(res[1], cc.lambda) } res[2].Mul(res[1], cc.lambda).Add(res[2], res[0]) res[2].Sub(res[2], inputs[0]) res[2].Div(res[2], cc.fr) return nil }
var DecomposeScalarG2 = func(scalarField *big.Int, inputs []*big.Int, res []*big.Int) error { cc := getInnerCurveConfig(scalarField) sp := ecc.SplitScalar(inputs[0], cc.glvBasis) res[0].Set(&(sp[0])) res[1].Set(&(sp[1])) one := big.NewInt(1) for res[0].Cmp(cc.lambda) < 1 && res[1].Cmp(cc.lambda) < 1 { res[0].Add(res[0], cc.lambda) res[0].Add(res[0], one) res[1].Add(res[1], cc.lambda) } res[2].Mul(res[1], cc.lambda).Add(res[2], res[0]) res[2].Sub(res[2], inputs[0]) res[2].Div(res[2], cc.fr) return nil }
Functions ¶
func DoubleAndAddStep ¶
func DoubleAndAddStep(api frontend.API, p1, p2 *G2Affine) (G2Affine, LineEvaluation, LineEvaluation)
DoubleAndAddStep
func DoubleStep ¶
func DoubleStep(api frontend.API, p1 *G2Affine) (G2Affine, LineEvaluation)
Types ¶
type G1Affine ¶
G1Affine point in affine coords
func (*G1Affine) AddAssign ¶
AddAssign adds p1 to p using the affine formulas with division, and return p
func (*G1Affine) AssertIsEqual ¶ added in v0.7.1
AssertIsEqual constraint self to be equal to other into the given constraint system
func (*G1Affine) DoubleAndAdd ¶
DoubleAndAdd computes 2*p1+p in affine coords
type G1Jac ¶
G1Jac point in Jacobian coords
func (*G1Jac) AssertIsEqual ¶ added in v0.7.1
AssertIsEqual constraint self to be equal to other into the given constraint system
func (*G1Jac) DoubleAssign ¶
DoubleAssign doubles the receiver point in jacobian coords and returns it
type G2Affine ¶
type G2Affine struct {
X, Y fields_bls12377.E2
}
G2Affine point in affine coords
func (*G2Affine) AssertIsEqual ¶ added in v0.7.1
AssertIsEqual constraint self to be equal to other into the given constraint system
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) DoubleAndAdd ¶
DoubleAndAdd computes 2*p1+p2 in affine coords
type G2Jac ¶
type G2Jac struct {
X, Y, Z fields_bls12377.E2
}
G2Jac point in Jacobian coords
func (*G2Jac) AssertIsEqual ¶ added in v0.7.1
AssertIsEqual constraint self to be equal to other into the given constraint system
type GT ¶ added in v0.7.1
type GT = fields_bls12377.E12
GT target group of the pairing
func FinalExponentiation ¶ added in v0.7.0
FinalExponentiation computes the final expo x**(p**6-1)(p**2+1)(p**4 - p**2 +1)/r
func MillerLoop ¶
MillerLoop computes the product of n miller loops (n can be 1)
type LineEvaluation ¶
type LineEvaluation struct {
R0, R1 fields_bls12377.E2
}
LineEvaluation represents a sparse Fp12 Elmt (result of the line evaluation)