bls381

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ID = gurvy.BLS381

ID bls381 ID

Variables

This section is empty.

Functions

func MulByNonResidue

func MulByNonResidue(out, in *fp.Element) *fp.Element

MulByNonResidue multiplies a fp.Element by -1 It would be nice to make this a method of fp.Element but fp.Element is outside this package

func MulByNonResidueInv

func MulByNonResidueInv(out, in *fp.Element) *fp.Element

MulByNonResidueInv multiplies a fp.Element by -1^{-1} It would be nice to make this a method of fp.Element but fp.Element is outside this package

Types

type Curve

type Curve struct {
	B fp.Element // A, B coefficients of the curve x^3 = y^2 +AX+b
	// contains filtered or unexported fields
}

Curve represents the BLS381 curve and pre-computed constants

func BLS381

func BLS381() *Curve

BLS381 returns BLS381 curve

func (*Curve) FinalExponentiation

func (curve *Curve) FinalExponentiation(z *e12, _z ...*e12) e12

FinalExponentiation computes the final expo x**(p**6-1)(p**2+1)(p**4 - p**2 +1)/r

func (*Curve) MillerLoop

func (curve *Curve) MillerLoop(P G1Affine, Q G2Affine, result *e12) *e12

MillerLoop Miller loop

type G1Affine

type G1Affine struct {
	X, Y fp.Element
}

G1Affine point in affine coordinates

func (*G1Affine) Equal

func (p *G1Affine) Equal(a *G1Affine) bool

Equal tests if two points (in Affine coordinates) are equal

func (*G1Affine) IsInfinity

func (p *G1Affine) IsInfinity() bool

IsInfinity checks if the point is infinity (in affine, it's encoded as (0,0))

func (*G1Affine) Neg

func (p *G1Affine) Neg(a *G1Affine) *G1Affine

Neg computes -G

func (*G1Affine) String

func (p *G1Affine) String(curve *Curve) string

func (*G1Affine) ToJacobian

func (p *G1Affine) ToJacobian(Q *G1Jac) *G1Jac

ToJacobian sets Q = p, Q in Jacboian, p in affine

type G1Jac

type G1Jac struct {
	X, Y, Z fp.Element
}

G1Jac is a point with fp.Element coordinates

func (*G1Jac) Add

func (p *G1Jac) Add(curve *Curve, a *G1Jac) *G1Jac

Add point addition in montgomery form no assumptions on z Note: calling Add with p.Equal(a) produces [0, 0, 0], call p.Double() instead https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl

func (*G1Jac) AddMixed

func (p *G1Jac) AddMixed(a *G1Affine) *G1Jac

AddMixed point addition in montgomery form assumes a is in affine coordinates (i.e a.z == 1) https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl

func (*G1Jac) Clone

func (p *G1Jac) Clone() *G1Jac

Clone returns a copy of self

func (*G1Jac) Double

func (p *G1Jac) Double() *G1Jac

Double doubles a point in Jacobian coordinates https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl

func (*G1Jac) Equal

func (p *G1Jac) Equal(a *G1Jac) bool

Equal tests if two points (in Jacobian coordinates) are equal

func (*G1Jac) MultiExp

func (p *G1Jac) MultiExp(curve *Curve, points []G1Affine, scalars []fr.Element) chan G1Jac

MultiExp complexity O(n)

func (*G1Jac) Neg

func (p *G1Jac) Neg(a *G1Jac) *G1Jac

Neg computes -G

func (*G1Jac) ScalarMul

func (p *G1Jac) ScalarMul(curve *Curve, a *G1Jac, scalar fr.Element) *G1Jac

ScalarMul multiplies a by scalar algorithm: a special case of Pippenger described by Bootle: https://jbootle.github.io/Misc/pippenger.pdf

func (*G1Jac) ScalarMulByGen

func (p *G1Jac) ScalarMulByGen(curve *Curve, scalar fr.Element) *G1Jac

ScalarMulByGen multiplies curve.g1Gen by scalar algorithm: a special case of Pippenger described by Bootle: https://jbootle.github.io/Misc/pippenger.pdf

func (*G1Jac) Set

func (p *G1Jac) Set(a *G1Jac) *G1Jac

Set set p to the provided point

func (*G1Jac) String

func (p *G1Jac) String(curve *Curve) string

func (*G1Jac) Sub

func (p *G1Jac) Sub(curve *Curve, a G1Jac) *G1Jac

Sub substracts two points on the curve

func (*G1Jac) ToAffineFromJac

func (p *G1Jac) ToAffineFromJac(res *G1Affine) *G1Affine

ToAffineFromJac rescale a point in Jacobian coord in z=1 plane WARNING super slow function (due to the division)

func (*G1Jac) ToProjFromJac

func (p *G1Jac) ToProjFromJac() *G1Jac

ToProjFromJac converts a point from Jacobian to projective coordinates

func (*G1Jac) WindowedMultiExp

func (p *G1Jac) WindowedMultiExp(curve *Curve, points []G1Jac, scalars []fr.Element) *G1Jac

WindowedMultiExp set p = scalars[0]*points[0] + ... + scalars[n]*points[n] assume: scalars in non-Montgomery form! assume: len(points)==len(scalars)>0, len(scalars[i]) equal for all i algorithm: a special case of Pippenger described by Bootle: https://jbootle.github.io/Misc/pippenger.pdf uses all availables runtime.NumCPU()

type G2Affine

type G2Affine struct {
	X, Y e2
}

G2Affine point in affine coordinates

func (*G2Affine) Equal

func (p *G2Affine) Equal(a *G2Affine) bool

Equal tests if two points (in Affine coordinates) are equal

func (*G2Affine) IsInfinity

func (p *G2Affine) IsInfinity() bool

IsInfinity checks if the point is infinity (in affine, it's encoded as (0,0))

func (*G2Affine) Neg

func (p *G2Affine) Neg(a *G2Affine) *G2Affine

Neg computes -G

func (*G2Affine) String

func (p *G2Affine) String(curve *Curve) string

func (*G2Affine) ToJacobian

func (p *G2Affine) ToJacobian(Q *G2Jac) *G2Jac

ToJacobian sets Q = p, Q in Jacboian, p in affine

type G2Jac

type G2Jac struct {
	X, Y, Z e2
}

G2Jac is a point with e2 coordinates

func (*G2Jac) Add

func (p *G2Jac) Add(curve *Curve, a *G2Jac) *G2Jac

Add point addition in montgomery form no assumptions on z Note: calling Add with p.Equal(a) produces [0, 0, 0], call p.Double() instead https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl

func (*G2Jac) AddMixed

func (p *G2Jac) AddMixed(a *G2Affine) *G2Jac

AddMixed point addition in montgomery form assumes a is in affine coordinates (i.e a.z == 1) https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-madd-2007-bl

func (*G2Jac) Clone

func (p *G2Jac) Clone() *G2Jac

Clone returns a copy of self

func (*G2Jac) Double

func (p *G2Jac) Double() *G2Jac

Double doubles a point in Jacobian coordinates https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2007-bl

func (*G2Jac) Equal

func (p *G2Jac) Equal(a *G2Jac) bool

Equal tests if two points (in Jacobian coordinates) are equal

func (*G2Jac) MultiExp

func (p *G2Jac) MultiExp(curve *Curve, points []G2Affine, scalars []fr.Element) chan G2Jac

MultiExp complexity O(n)

func (*G2Jac) Neg

func (p *G2Jac) Neg(a *G2Jac) *G2Jac

Neg computes -G

func (*G2Jac) ScalarMul

func (p *G2Jac) ScalarMul(curve *Curve, a *G2Jac, scalar fr.Element) *G2Jac

ScalarMul multiplies a by scalar algorithm: a special case of Pippenger described by Bootle: https://jbootle.github.io/Misc/pippenger.pdf

func (*G2Jac) ScalarMulByGen

func (p *G2Jac) ScalarMulByGen(curve *Curve, scalar fr.Element) *G2Jac

ScalarMulByGen multiplies curve.g2Gen by scalar algorithm: a special case of Pippenger described by Bootle: https://jbootle.github.io/Misc/pippenger.pdf

func (*G2Jac) Set

func (p *G2Jac) Set(a *G2Jac) *G2Jac

Set set p to the provided point

func (*G2Jac) String

func (p *G2Jac) String(curve *Curve) string

func (*G2Jac) Sub

func (p *G2Jac) Sub(curve *Curve, a G2Jac) *G2Jac

Sub substracts two points on the curve

func (*G2Jac) ToAffineFromJac

func (p *G2Jac) ToAffineFromJac(res *G2Affine) *G2Affine

ToAffineFromJac rescale a point in Jacobian coord in z=1 plane WARNING super slow function (due to the division)

func (*G2Jac) ToProjFromJac

func (p *G2Jac) ToProjFromJac() *G2Jac

ToProjFromJac converts a point from Jacobian to projective coordinates

func (*G2Jac) WindowedMultiExp

func (p *G2Jac) WindowedMultiExp(curve *Curve, points []G2Jac, scalars []fr.Element) *G2Jac

WindowedMultiExp set p = scalars[0]*points[0] + ... + scalars[n]*points[n] assume: scalars in non-Montgomery form! assume: len(points)==len(scalars)>0, len(scalars[i]) equal for all i algorithm: a special case of Pippenger described by Bootle: https://jbootle.github.io/Misc/pippenger.pdf uses all availables runtime.NumCPU()

type PairingResult

type PairingResult = e12

Directories

Path Synopsis
Package fp contains field arithmetic operations Package fp contains field arithmetic operations Package fp contains field arithmetic operations Package fp contains field arithmetic operations
Package fp contains field arithmetic operations Package fp contains field arithmetic operations Package fp contains field arithmetic operations Package fp contains field arithmetic operations
Package fr contains field arithmetic operations Package fr contains field arithmetic operations Package fr contains field arithmetic operations Package fr contains field arithmetic operations
Package fr contains field arithmetic operations Package fr contains field arithmetic operations Package fr contains field arithmetic operations Package fr contains field arithmetic operations

Jump to

Keyboard shortcuts

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