Documentation
¶
Overview ¶
Package bls12 implements bls12-381 pairing-friendly elliptic curve construction. This package operates, internally, on projective coordinates.
Index ¶
- func Pair(g1 *G1Point, g2 *G2Point) *fq12
- func RandFieldElement(reader io.Reader) (*big.Int, error)
- type G1Point
- func (z *G1Point) Add(x, y *G1Point) *G1Point
- func (z *G1Point) HashToPoint(buf []byte) *G1Point
- func (z *G1Point) Marshal() []byte
- func (z *G1Point) ScalarBaseMult(scalar *big.Int) *G1Point
- func (z *G1Point) ScalarMult(x *G1Point, scalar *big.Int) *G1Point
- func (z *G1Point) ToAffine() *G1Point
- func (z *G1Point) Unmarshal(data []byte) error
- type G2Point
- func (z *G2Point) Add(x, y *G2Point) *G2Point
- func (x *G2Point) Equal(y *G2Point) bool
- func (z *G2Point) HashToPoint(buf []byte) *G2Point
- func (z *G2Point) HashToPointWithDomain(buf []byte, domain uint64) *G2Point
- func (z *G2Point) ScalarBaseMult(scalar *big.Int) *G2Point
- func (z *G2Point) ScalarMult(x *G2Point, scalar *big.Int) *G2Point
- func (z *G2Point) Set(x *G2Point) *G2Point
- func (z *G2Point) ToAffine() *G2Point
- type GT
- func (z *GT) Add(x, y *fq12) *fq12
- func (z *GT) Conjugate(x *fq12) *fq12
- func (x *GT) Equal(y *fq12) bool
- func (z *GT) Exp(x *fq12, y *big.Int) *fq12
- func (z *GT) Frobenius(x *fq12, power uint64) *fq12
- func (z *GT) Inv(x *fq12) *fq12
- func (z *GT) Mul(x, y *fq12) *fq12
- func (z *GT) Set(x *fq12) *fq12
- func (z *GT) SetOne() *fq12
- func (z *GT) SparseMul014(x *fq12, c0 *fq2, c1 *fq2, c4 *fq2) *fq12
- func (z *GT) Sqr(x *fq12) *fq12
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pair ¶
Pair implements the optimal ate pairing algorithm on BLS curves. See https://eprint.iacr.org/2019/077.pdf - Algorithm 1.
Types ¶
type G1Point ¶
type G1Point struct {
// contains filtered or unexported fields
}
func (*G1Point) HashToPoint ¶
HashToPoint uses the Shallue and van de Woestijne encoding. The point is guaranteed to be in the subgroup.
func (*G1Point) ScalarBaseMult ¶
ScalarBaseMult returns k*G, where G is the base point of the group and k is an integer in big-endian form.
func (*G1Point) ScalarMult ¶
ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
type G2Point ¶
type G2Point struct {
// contains filtered or unexported fields
}
func (*G2Point) HashToPoint ¶
func (*G2Point) HashToPointWithDomain ¶
HashToPointWithDomain uses the Shallue and van de Woestijne encoding. The point is guaranteed to be in the subgroup.
func (*G2Point) ScalarBaseMult ¶
ScalarBaseMult returns k*G, where G is the base point of the group and k is an integer in big-endian form.
func (*G2Point) ScalarMult ¶
ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
type GT ¶
type GT struct {
// contains filtered or unexported fields
}
func (*GT) Conjugate ¶
func (z *GT) Conjugate(x *fq12) *fq12
Conjugate sets z to the conjugate of x and returns z.
func (*GT) Frobenius ¶
func (z *GT) Frobenius(x *fq12, power uint64) *fq12
Frobenius sets z to the pth-power Frobenius of x and returns z.
func (*GT) Inv ¶
func (z *GT) Inv(x *fq12) *fq12
Inv sets z to 1/x and returns z. See "Implementing cryptographic pairings", M. Scott - section 3.2.
func (*GT) Mul ¶
func (z *GT) Mul(x, y *fq12) *fq12
Mul sets z to the product x*y and returns z. Mul utilizes Karatsuba's method.
func (*GT) SparseMul014 ¶
func (z *GT) SparseMul014(x *fq12, c0 *fq2, c1 *fq2, c4 *fq2) *fq12
SparseMult sets z to the product of x with c0, c1, c4 and returns z. SparseMult utilizes the sparness property to avoid full fq12 arithmetic. See https://github.com/zkcrypto/pairing/blob/master/src/bls12_381/fq12.rs#L34.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package sig1 implements the BLS signature scheme with signatures on G1.
|
Package sig1 implements the BLS signature scheme with signatures on G1. |
Package sig2 implements the BLS signature scheme with signatures on G2.
|
Package sig2 implements the BLS signature scheme with signatures on G2. |