G1Size is the length in bytes of an element in G1 in uncompressed form..
const G1Size = 2 * ff.FpSize
G1SizeCompressed is the length in bytes of an element in G1 in compressed form.
const G1SizeCompressed = ff.FpSize
G2Size is the length in bytes of an element in G2 in uncompressed form..
const G2Size = 2 * ff.Fp2Size
G2SizeCompressed is the length in bytes of an element in G2 in compressed form.
const G2SizeCompressed = ff.Fp2Size
GtSize is the length in bytes of an element in Gt.
const GtSize = ff.URootSize
const ScalarSize = ff.ScalarSize
func Order() []byte
Order returns the order of the pairing groups, returned as a big-endian slice.
Order = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
G1 is a point in the BLS12 curve over Fp.
type G1 struct {
// contains filtered or unexported fields
}
func G1Generator() *G1
G1Generator returns the generator point of G1.
func (g *G1) Add(P, Q *G1)
Add updates g=P+Q.
func (g G1) Bytes() []byte
Bytes serializes a G1 element in uncompressed form.
func (g G1) BytesCompressed() []byte
Bytes serializes a G1 element in compressed form.
func (g *G1) Double()
Double updates g = 2g.
func (g *G1) Encode(input, dst []byte)
EncodeToCurve is a non-uniform encoding from an input byte string (and an optional domain separation tag) to elements in G1. This function must not be used as a hash function, otherwise use G1.Hash instead.
func (g *G1) Hash(input, dst []byte)
Hash produces an element of G1 from the hash of an input byte string and an optional domain separation tag. This function is safe to use when a random oracle returning points in G1 be required.
func (g *G1) IsEqual(p *G1) bool
IsEqual returns true if g and p are equivalent.
func (g *G1) IsIdentity() bool
IsIdentity return true if the point is the identity of G1.
func (g *G1) IsOnG1() bool
IsOnG1 returns true if the point is in the group G1.
func (g *G1) Neg()
Neg inverts g.
func (g *G1) ScalarMult(k *Scalar, P *G1)
ScalarMult calculates g = kP.
func (g *G1) SetBytes(b []byte) error
SetBytes sets g to the value in bytes, and returns a non-nil error if not in G1.
func (g *G1) SetIdentity()
SetIdentity assigns g to the identity element.
func (g G1) String() string
G2 is a point in the twist of the BLS12 curve over Fp2.
type G2 struct {
// contains filtered or unexported fields
}
func G2Generator() *G2
G2Generator returns the generator point of G2.
func (g *G2) Add(P, Q *G2)
Add updates g=P+Q.
func (g G2) Bytes() []byte
Bytes serializes a G2 element in uncompressed form.
func (g G2) BytesCompressed() []byte
Bytes serializes a G2 element in compressed form.
func (g *G2) Double()
Double updates g = 2g.
func (g *G2) Encode(input, dst []byte)
EncodeToCurve is a non-uniform encoding from an input byte string (and an optional domain separation tag) to elements in G2. This function must not be used as a hash function, otherwise use G2.Hash instead.
func (g *G2) Hash(input, dst []byte)
Hash produces an element of G2 from the hash of an input byte string and an optional domain separation tag. This function is safe to use when a random oracle returning points in G2 be required.
func (g *G2) IsEqual(p *G2) bool
IsEqual returns true if g and p are equivalent.
func (g *G2) IsIdentity() bool
IsIdentity return true if the point is the identity of G2.
func (g *G2) IsOnG2() bool
IsOnG2 returns true if the point is in the group G2.
func (g *G2) Neg()
Neg inverts g.
func (g *G2) ScalarMult(k *Scalar, P *G2)
ScalarMult calculates g = kP.
func (g *G2) SetBytes(b []byte) error
SetBytes sets g to the value in bytes, and returns a non-nil error if not in G2.
func (g *G2) SetIdentity()
SetIdentity assigns g to the identity element.
func (g G2) String() string
Gt represents an element of the output (multiplicative) group of a pairing.
type Gt struct {
// contains filtered or unexported fields
}
func Pair(P *G1, Q *G2) *Gt
Pair calculates the ate-pairing of P and Q.
func ProdPair(P []*G1, Q []*G2, n []*Scalar) *Gt
ProdPair calculates the product of pairings, i.e., \Prod_i pair(Pi,Qi)^ni.
func ProdPairFrac(P []*G1, Q []*G2, signs []int) *Gt
ProdPairFrac computes the product e(P, Q)^sign where sign is 1 or -1
func (z *Gt) Exp(x *Gt, n *Scalar)
Exp calculates z=x^n, where n is the exponent in big-endian order.
func (z *Gt) Inv(x *Gt)
func (z Gt) IsEqual(x *Gt) bool
func (z Gt) IsIdentity() bool
func (z Gt) MarshalBinary() ([]byte, error)
func (z *Gt) Mul(x, y *Gt)
func (z *Gt) SetIdentity()
func (z *Gt) Sqr(x *Gt)
func (z Gt) String() string
func (z *Gt) UnmarshalBinary(b []byte) error
Scalar represents positive integers in the range 0 <= x < Order.
type Scalar = ff.Scalar