Documentation ¶
Index ¶
- Variables
- func Exp(c, a *Fe, e *big.Int)
- func Fp12Add(c, a, b *Fe12)
- func Fp12Conjugate(c, a *Fe12)
- func Fp12Double(c, a *Fe12)
- func Fp12Neg(c, a *Fe12)
- func Fp12Sub(c, a, b *Fe12)
- func Fp2Conjugate(c, a *Fe2)
- func Fp2Neg(c, a *Fe2)
- func Fp6Add(c, a, b *Fe6)
- func Fp6AddAssign(a, b *Fe6)
- func Fp6Double(c, a *Fe6)
- func Fp6DoubleAssign(a *Fe6)
- func Fp6Ladd(c, a, b *Fe6)
- func Fp6Neg(c, a *Fe6)
- func Fp6Sub(c, a, b *Fe6)
- func Fp6SubAssign(a, b *Fe6)
- func FromMont(c, a *Fe)
- func Inverse(inv, e *Fe)
- func InverseBatch(in []Fe)
- func InverseBatchFr(in []Fr)
- func IsQuadraticNonResidue(a *Fe) bool
- func RSqrt(c, a *Fe) bool
- func RedInverseBatchFr(in []Fr)
- func Sqrt(c, a *Fe) bool
- func SqrtAddchain(c, a *Fe)
- func ToBig(e *Fe) *big.Int
- func ToBytes(e *Fe) []byte
- func ToMont(c, a *Fe)
- func ToString(e *Fe) (s string)
- func Wfp2MulGeneric(c *Wfe2, a, b *Fe2)
- func Wfp2SquareGeneric(c *Wfe2, a *Fe2)
- func Wfp6AddAssign(a, b *Wfe6)
- func Wfp6SubAssign(a, b *Wfe6)
- type E
- type Engine
- type Fe
- func (fe *Fe) Big() *big.Int
- func (fe *Fe) Bytes() []byte
- func (fe *Fe) Cmp(fe2 *Fe) int
- func (e *Fe) Div2(u uint64)
- func (fe *Fe) Equal(fe2 *Fe) bool
- func (fe *Fe) IsEven() bool
- func (fe *Fe) IsOdd() bool
- func (fe *Fe) IsOne() bool
- func (fe *Fe) IsValid() bool
- func (fe *Fe) IsZero() bool
- func (e *Fe) Mul2() uint64
- func (fe *Fe) One() *Fe
- func (fe *Fe) Rand(r io.Reader) (*Fe, error)
- func (fe *Fe) Set(fe2 *Fe) *Fe
- func (fe *Fe) SetBig(a *big.Int) *Fe
- func (fe *Fe) SetBytes(in []byte) *Fe
- func (fe *Fe) SetString(s string) (*Fe, error)
- func (e *Fe) Sign() bool
- func (e *Fe) SignBE() bool
- func (fe *Fe) String() (s string)
- func (fe *Fe) Zero() *Fe
- type Fe12
- type Fe2
- func (e *Fe2) Equal(e2 *Fe2) bool
- func (e *Fe2) FromMont(a *Fe2)
- func (e *Fe2) FromWide(w *Wfe2)
- func (e *Fe2) IsOne() bool
- func (e *Fe2) IsZero() bool
- func (e *Fe2) One() *Fe2
- func (e *Fe2) Rand(r io.Reader) (*Fe2, error)
- func (e *Fe2) Set(e2 *Fe2) *Fe2
- func (e *Fe2) Sign() bool
- func (e *Fe2) SignBE() bool
- func (e *Fe2) Zero() *Fe2
- type Fe6
- type Fp12
- func (e *Fp12) CyclotomicExp(c, a *Fe12, s *big.Int)
- func (e *Fp12) CyclotomicSquare(a *Fe12)
- func (e *Fp12) Exp(c, a *Fe12, s *big.Int)
- func (e *Fp12) Fp2() *Fp2
- func (e *Fp12) Fp4Square(c0, c1, a0, a1 *Fe2)
- func (e *Fp12) FrobeniusMap1(a *Fe12)
- func (e *Fp12) FrobeniusMap2(a *Fe12)
- func (e *Fp12) FrobeniusMap3(a *Fe12)
- func (e *Fp12) FromBytes(in []byte) (*Fe12, error)
- func (e *Fp12) Inverse(c, a *Fe12)
- func (e *Fp12) Mul(c, a, b *Fe12)
- func (e *Fp12) Mul014(a *Fe12, b0, b1, b4 *Fe2)
- func (e *Fp12) MulAssign(a, b *Fe12)
- func (e *Fp12) New() *Fe12
- func (e *Fp12) One() *Fe12
- func (e *Fp12) Square(c, a *Fe12)
- func (e *Fp12) SquareAssign(a *Fe12)
- func (e *Fp12) ToBytes(a *Fe12) []byte
- func (e *Fp12) Zero() *Fe12
- type Fp12temp
- type Fp2
- func (e *Fp2) Exp(c, a *Fe2, s *big.Int)
- func (e *Fp2) FrobeniusMap(a *Fe2, power int)
- func (e *Fp2) FrobeniusMap1(a *Fe2)
- func (e *Fp2) FromBytes(in []byte) (*Fe2, error)
- func (e *Fp2) Inverse(c, a *Fe2)
- func (e *Fp2) InverseBatch(in []Fe2)
- func (e *Fp2) IsQuadraticNonResidue(a *Fe2) bool
- func (e *Fp2) Mul(c, a, b *Fe2)
- func (e *Fp2) Mul0(c, a *Fe2, b *Fe)
- func (e *Fp2) Mul0Assign(a *Fe2, b *Fe)
- func (e *Fp2) MulAssign(a, b *Fe2)
- func (e *Fp2) MulByB(c, a *Fe2)
- func (e *Fp2) New() *Fe2
- func (e *Fp2) One() *Fe2
- func (e *Fp2) Sqrt(c, a *Fe2) bool
- func (e *Fp2) SqrtAlignBLST(out, ret, sqrt, inp *Fe2) bool
- func (e *Fp2) SqrtBLST(out, inp *Fe2) bool
- func (e *Fp2) Square(c, a *Fe2)
- func (e *Fp2) SquareAssign(a *Fe2)
- func (e *Fp2) ToBytes(a *Fe2) []byte
- func (e *Fp2) Zero() *Fe2
- type Fp2Temp
- type Fp6
- func (e *Fp6) Exp(c, a *Fe6, s *big.Int)
- func (e *Fp6) FrobeniusMap(a *Fe6, power int)
- func (e *Fp6) FrobeniusMap1(a *Fe6)
- func (e *Fp6) FrobeniusMap2(a *Fe6)
- func (e *Fp6) FrobeniusMap3(a *Fe6)
- func (e *Fp6) FromBytes(b []byte) (*Fe6, error)
- func (e *Fp6) Inverse(c, a *Fe6)
- func (e *Fp6) Mul(c *Fe6, a, b *Fe6)
- func (e *Fp6) MulAssign(a, b *Fe6)
- func (e *Fp6) MulByBaseField(c, a *Fe6, b *Fe2)
- func (e *Fp6) MulByNonResidue(c, a *Fe6)
- func (e *Fp6) New() *Fe6
- func (e *Fp6) One() *Fe6
- func (e *Fp6) Square(c, a *Fe6)
- func (e *Fp6) ToBytes(a *Fe6) []byte
- func (e *Fp6) Wmul(c *Wfe6, a, b *Fe6)
- func (e *Fp6) Wmul01(c *Wfe6, a *Fe6, b0, b1 *Fe2)
- func (e *Fp6) Wmul1(c *Wfe6, a *Fe6, b1 *Fe2)
- func (e *Fp6) WmulByNonResidue(c, a *Wfe6)
- func (e *Fp6) WmulByNonResidueAssign(a *Wfe6)
- func (e *Fp6) Wsquare(c *Wfe6, a *Fe6)
- func (e *Fp6) Zero() *Fe6
- type Fp6Temp
- type Fr
- func (e *Fr) Add(a, b *Fr)
- func (e *Fr) Bit(at int) bool
- func (e *Fr) Cmp(e1 *Fr) int
- func (e *Fr) Double(a *Fr)
- func (e *Fr) Equal(e2 *Fr) bool
- func (e *Fr) Exp(a *Fr, ee *big.Int)
- func (e *Fr) FromBytes(in []byte) *Fr
- func (e *Fr) FromRed()
- func (e *Fr) Inverse(a *Fr)
- func (e *Fr) IsOne() bool
- func (e *Fr) IsRedOne() bool
- func (e *Fr) IsZero() bool
- func (e *Fr) Mul(a, b *Fr)
- func (e *Fr) Neg(a *Fr)
- func (e *Fr) One() *Fr
- func (e *Fr) Rand(r io.Reader) (*Fr, error)
- func (e *Fr) RedExp(a *Fr, ee *big.Int)
- func (e *Fr) RedFromBytes(in []byte) *Fr
- func (e *Fr) RedInverse(ei *Fr)
- func (e *Fr) RedMul(a, b *Fr)
- func (e *Fr) RedOne() *Fr
- func (e *Fr) RedSquare(a *Fr)
- func (e *Fr) RedToBig() *big.Int
- func (e *Fr) RedToBytes() []byte
- func (e *Fr) Set(e2 *Fr) *Fr
- func (e *Fr) Square(a *Fr)
- func (e *Fr) Sub(a, b *Fr)
- func (e *Fr) ToBig() *big.Int
- func (e *Fr) ToBytes() []byte
- func (e *Fr) ToRed()
- func (e *Fr) Zero() *Fr
- type G1
- func (g *G1) Add(r, p1, p2 *PointG1) *PointG1
- func (g *G1) AddMixed(r, p1, p2 *PointG1) *PointG1
- func (g *G1) Affine(p *PointG1) *PointG1
- func (g *G1) AffineBatch(p []*PointG1)
- func (g *G1) ClearCofactor(p *PointG1) *PointG1
- func (g *G1) Double(r, p *PointG1) *PointG1
- func (g *G1) EncodeToCurve(msg, domain []byte) (*PointG1, error)
- func (g *G1) Equal(p1, p2 *PointG1) bool
- func (g *G1) FromBytes(in []byte) (*PointG1, error)
- func (g *G1) FromCompressed(compressed []byte) (*PointG1, error)
- func (g *G1) FromUncompressed(uncompressed []byte) (*PointG1, error)
- func (g *G1) HashToCurve(msg, domain []byte) (*PointG1, error)
- func (g *G1) InCorrectSubgroup(p *PointG1) bool
- func (g *G1) IsAffine(p *PointG1) bool
- func (g *G1) IsOnCurve(p *PointG1) bool
- func (g *G1) IsZero(p *PointG1) bool
- func (g *G1) MapToCurve(in []byte) (*PointG1, error)
- func (g *G1) MulScalar(r, p *PointG1, e *Fr) *PointG1
- func (g *G1) MulScalarBig(r, p *PointG1, e *big.Int) *PointG1
- func (g *G1) MultiExp(r *PointG1, points []*PointG1, scalars []*Fr) (*PointG1, error)
- func (g *G1) MultiExpBig(r *PointG1, points []*PointG1, scalars []*big.Int) (*PointG1, error)
- func (g *G1) Neg(r, p *PointG1) *PointG1
- func (g *G1) New() *PointG1
- func (g *G1) One() *PointG1
- func (g *G1) Q() *big.Int
- func (g *G1) Sub(c, a, b *PointG1) *PointG1
- func (g *G1) ToBytes(p *PointG1) []byte
- func (g *G1) ToCompressed(p *PointG1) []byte
- func (g *G1) ToUncompressed(p *PointG1) []byte
- func (g *G1) Zero() *PointG1
- type G2
- func (g *G2) Add(r, p1, p2 *PointG2) *PointG2
- func (g *G2) AddMixed(r, p1, p2 *PointG2) *PointG2
- func (g *G2) Affine(p *PointG2) *PointG2
- func (g *G2) AffineBatch(p []*PointG2)
- func (g *G2) ClearCofactor(p *PointG2) *PointG2
- func (g *G2) Double(r, p *PointG2) *PointG2
- func (g *G2) EncodeToCurve(msg, domain []byte) (*PointG2, error)
- func (g *G2) Equal(p1, p2 *PointG2) bool
- func (g *G2) FromBytes(in []byte) (*PointG2, error)
- func (g *G2) FromCompressed(compressed []byte) (*PointG2, error)
- func (g *G2) FromUncompressed(uncompressed []byte) (*PointG2, error)
- func (g *G2) HashToCurve(msg, domain []byte) (*PointG2, error)
- func (g *G2) InCorrectSubgroup(p *PointG2) bool
- func (g *G2) IsAffine(p *PointG2) bool
- func (g *G2) IsOnCurve(p *PointG2) bool
- func (g *G2) IsZero(p *PointG2) bool
- func (g *G2) MapToCurve(in []byte) (*PointG2, error)
- func (g *G2) MulScalar(r, p *PointG2, e *Fr) *PointG2
- func (g *G2) MulScalarBig(r, p *PointG2, e *big.Int) *PointG2
- func (g *G2) MultiExp(r *PointG2, points []*PointG2, scalars []*Fr) (*PointG2, error)
- func (g *G2) MultiExpBig(r *PointG2, points []*PointG2, scalars []*big.Int) (*PointG2, error)
- func (g *G2) Neg(r, p *PointG2) *PointG2
- func (g *G2) New() *PointG2
- func (g *G2) One() *PointG2
- func (g *G2) Q() *big.Int
- func (g *G2) Sub(c, a, b *PointG2) *PointG2
- func (g *G2) ToBytes(p *PointG2) []byte
- func (g *G2) ToCompressed(p *PointG2) []byte
- func (g *G2) ToUncompressed(p *PointG2) []byte
- func (g *G2) Zero() *PointG2
- type GT
- func (g *GT) Add(c, a, b *E)
- func (g *GT) Exp(c, a *E, s *big.Int)
- func (g *GT) FromBytes(in []byte) (*E, error)
- func (g *GT) Inverse(c, a *E)
- func (g *GT) IsValid(e *E) bool
- func (g *GT) Mul(c, a, b *E)
- func (g *GT) New() *E
- func (g *GT) Q() *big.Int
- func (g *GT) Square(c, a *E)
- func (g *GT) Sub(c, a, b *E)
- func (g *GT) ToBytes(e *E) []byte
- type PointG1
- type PointG2
- type Wfe
- type Wfe2
- type Wfe6
Constants ¶
This section is empty.
Variables ¶
var G1One = g1One
var G2One = g2One
Functions ¶
func Fp12Conjugate ¶
func Fp12Conjugate(c, a *Fe12)
func Fp12Double ¶
func Fp12Double(c, a *Fe12)
func Fp2Conjugate ¶
func Fp2Conjugate(c, a *Fe2)
func Fp6AddAssign ¶
func Fp6AddAssign(a, b *Fe6)
func Fp6DoubleAssign ¶
func Fp6DoubleAssign(a *Fe6)
func Fp6SubAssign ¶
func Fp6SubAssign(a, b *Fe6)
func InverseBatch ¶
func InverseBatch(in []Fe)
func InverseBatchFr ¶
func InverseBatchFr(in []Fr)
func IsQuadraticNonResidue ¶
func RedInverseBatchFr ¶
func RedInverseBatchFr(in []Fr)
func SqrtAddchain ¶
func SqrtAddchain(c, a *Fe)
func Wfp2MulGeneric ¶
func Wfp2SquareGeneric ¶
func Wfp6AddAssign ¶
func Wfp6AddAssign(a, b *Wfe6)
func Wfp6SubAssign ¶
func Wfp6SubAssign(a, b *Wfe6)
Types ¶
type E ¶
type E = Fe12
E is type for target group element
type Engine ¶
Engine is BLS12-381 elliptic curve pairing engine
func (*Engine) AddPairInv ¶
AddPairInv adds a G1, G2 point pair to pairing engine. G1 point is negated.
type Fe ¶
type Fe [fpNumberOfLimbs]uint64
Fe is base field element representation
func From64Bytes ¶
func FromString ¶
type Fe12 ¶
type Fe12 [2]Fe6
Fe12 is element representation of 'Fp12' field which is quadratic extention of 'Fp6' Representation follows c[0] + c[1] * w encoding order.
type Fe2 ¶
type Fe2 [2]Fe
Fe2 is element representation of 'Fp2' which is quadratic extention of base field 'fp' Representation follows c[0] + c[1] * u encoding order.
type Fe6 ¶
type Fe6 [3]Fe2
Fe6 is element representation of 'Fp6' field which is cubic extention of 'Fp2' Representation follows c[0] + c[1] * v + c[2] * v^2 encoding order.
type Fp12 ¶
type Fp12 struct { Fp12temp // contains filtered or unexported fields }
func (*Fp12) CyclotomicSquare ¶
func (*Fp12) FrobeniusMap1 ¶
func (*Fp12) FrobeniusMap2 ¶
func (*Fp12) FrobeniusMap3 ¶
func (*Fp12) SquareAssign ¶
type Fp12temp ¶
type Fp12temp struct {
// contains filtered or unexported fields
}
func NewFp12Temp ¶
func NewFp12Temp() Fp12temp
type Fp2 ¶
type Fp2 struct {
Fp2Temp
}
func (*Fp2) FrobeniusMap ¶
func (*Fp2) FrobeniusMap1 ¶
func (*Fp2) InverseBatch ¶
func (*Fp2) IsQuadraticNonResidue ¶
func (*Fp2) Mul0Assign ¶
func (*Fp2) SqrtAlignBLST ¶
func (*Fp2) SquareAssign ¶
type Fp2Temp ¶
type Fp2Temp struct {
// contains filtered or unexported fields
}
func NewFp2Temp ¶
func NewFp2Temp() Fp2Temp
type Fp6 ¶
type Fp6 struct { Fp6Temp // contains filtered or unexported fields }
func (*Fp6) FrobeniusMap ¶
func (*Fp6) FrobeniusMap1 ¶
func (*Fp6) FrobeniusMap2 ¶
func (*Fp6) FrobeniusMap3 ¶
func (*Fp6) MulByBaseField ¶
func (*Fp6) MulByNonResidue ¶
func (*Fp6) WmulByNonResidue ¶
func (*Fp6) WmulByNonResidueAssign ¶
type Fp6Temp ¶
type Fp6Temp struct {
// contains filtered or unexported fields
}
func NewFp6Temp ¶
func NewFp6Temp() Fp6Temp
type Fr ¶
type Fr [4]uint64
func (*Fr) RedFromBytes ¶
func (*Fr) RedInverse ¶
func (*Fr) RedToBytes ¶
type G1 ¶
type G1 struct {
// contains filtered or unexported fields
}
G1 is struct for G1 group.
func (*G1) AddMixed ¶
Add adds two G1 points p1, p2 and assigns the result to point at first argument. Expects the second point p2 in affine form.
func (*G1) AffineBatch ¶
AffineBatch given multiple of points returns affine representations
func (*G1) ClearCofactor ¶
func (*G1) Double ¶
Double doubles a G1 point p and assigns the result to the point at first argument.
func (*G1) EncodeToCurve ¶
EncodeToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_NU_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G1) FromBytes ¶
FromBytes constructs a New point given uncompressed byte input. Input String is expected to be Equal to 96 Bytes and concatenation of x and y cooridanates. (0, 0) is considered as infinity.
func (*G1) FromCompressed ¶
FromCompressed expects byte slice at least 48 Bytes and given Bytes returns a New point in G1. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G1) FromUncompressed ¶
FromUncompressed expects byte slice at least 96 Bytes and given Bytes returns a New point in G1. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G1) HashToCurve ¶
HashToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_RO_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G1) InCorrectSubgroup ¶
InCorrectSubgroup checks whether given point is in correct subgroup.
func (*G1) MapToCurve ¶
MapToCurve given a byte slice returns a valid G1 point. This mapping function implements the Simplified Shallue-van de Woestijne-Ulas method. https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06 Input byte slice should be a valid field element, otherwise an error is returned.
func (*G1) MulScalar ¶
MulScalar multiplies a point by given scalar value and assigns the result to point at first argument.
func (*G1) MulScalarBig ¶
MulScalar multiplies a point by given scalar value in big.Int and assigns the result to point at first argument.
func (*G1) MultiExp ¶
MultiExp calculates multi exponentiation. Given pairs of G1 point and scalar values `(P_0, e_0), (P_1, e_1), ... (P_n, e_n)`, calculates `r = e_0 * P_0 + e_1 * P_1 + ... + e_n * P_n`. Length of points and scalars are expected to be Equal, otherwise an error is returned. Result is assigned to point at first argument.
func (*G1) MultiExpBig ¶
MultiExpBig calculates multi exponentiation. Scalar values are received as big.Int type. Given pairs of G1 point and scalar values `(P_0, e_0), (P_1, e_1), ... (P_n, e_n)`, calculates `r = e_0 * P_0 + e_1 * P_1 + ... + e_n * P_n`. Length of points and scalars are expected to be Equal, otherwise an error is returned. Result is assigned to point at first argument.
func (*G1) New ¶
New creates a New G1 Point which is Equal to Zero in other words point at infinity.
func (*G1) Sub ¶
Sub subtracts two G1 points p1, p2 and assigns the result to point at first argument.
func (*G1) ToBytes ¶
ToBytes serializes a point into Bytes in uncompressed form. ToBytes returns (0, 0) if point is infinity.
func (*G1) ToCompressed ¶
ToCompressed given a G1 point returns Bytes in compressed form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G1) ToUncompressed ¶
ToUncompressed given a G1 point returns Bytes in uncompressed (x, y) form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
type G2 ¶
type G2 struct {
// contains filtered or unexported fields
}
G2 is struct for G2 group.
func (*G2) AddMixed ¶
Add adds two G1 points p1, p2 and assigns the result to point at first argument. Expects the second point p2 in affine form.
func (*G2) AffineBatch ¶
AffineBatch given multiple of points returns affine representations
func (*G2) ClearCofactor ¶
ClearCofactor maps given a G2 point to correct subgroup
func (*G2) Double ¶
Double doubles a G2 point p and assigns the result to the point at first argument.
func (*G2) EncodeToCurve ¶
EncodeToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_NU_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G2) FromBytes ¶
FromBytes constructs a New point given uncompressed byte input. Input String expected to be 192 Bytes and concatenation of x and y values Point (0, 0) is considered as infinity.
func (*G2) FromCompressed ¶
FromCompressed expects byte slice at least 96 Bytes and given Bytes returns a New point in G2. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G2) FromUncompressed ¶
FromUncompressed expects byte slice at least 192 Bytes and given Bytes returns a New point in G2. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G2) HashToCurve ¶
HashToCurve given a message and domain seperator tag returns the hash result which is a valid curve point. Implementation follows BLS12381G1_XMD:SHA-256_SSWU_RO_ suite at https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06
func (*G2) InCorrectSubgroup ¶
InCorrectSubgroup checks whether given point is in correct subgroup.
func (*G2) MapToCurve ¶
MapToCurve given a byte slice returns a valid G2 point. This mapping function implements the Simplified Shallue-van de Woestijne-Ulas method. https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-05#section-6.6.2 Input byte slice should be a valid field element, otherwise an error is returned.
func (*G2) MulScalar ¶
MulScalar multiplies a point by given scalar value and assigns the result to point at first argument.
func (*G2) MulScalarBig ¶
MulScalarBig multiplies a point by given scalar value in big.Int and assigns the result to point at first argument.
func (*G2) MultiExp ¶
MultiExp calculates multi exponentiation. Given pairs of G2 point and scalar values `(P_0, e_0), (P_1, e_1), ... (P_n, e_n)`, calculates `r = e_0 * P_0 + e_1 * P_1 + ... + e_n * P_n`. Length of points and scalars are expected to be Equal, otherwise an error is returned. Result is assigned to point at first argument.
func (*G2) MultiExpBig ¶
MultiExpBig calculates multi exponentiation. Scalar values are received as big.Int type. Given pairs of G2 point and scalar values `(P_0, e_0), (P_1, e_1), ... (P_n, e_n)`, calculates `r = e_0 * P_0 + e_1 * P_1 + ... + e_n * P_n`. Length of points and scalars are expected to be Equal, otherwise an error is returned. Result is assigned to point at first argument.
func (*G2) New ¶
New creates a New G2 Point which is Equal to Zero in other words point at infinity.
func (*G2) Sub ¶
Sub subtracts two G2 points p1, p2 and assigns the result to point at first argument.
func (*G2) ToBytes ¶
ToBytes serializes a point into Bytes in uncompressed form, returns (0, 0) if point is infinity.
func (*G2) ToCompressed ¶
ToCompressed given a G2 point returns Bytes in compressed form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
func (*G2) ToUncompressed ¶
ToUncompressed given a G2 point returns Bytes in uncompressed (x, y) form of the point. Serialization rules are in line with zcash library. See below for details. https://github.com/zcash/librustzcash/blob/master/pairing/src/bls12_381/README.md#serialization https://docs.rs/bls12_381/0.1.1/bls12_381/notes/serialization/index.html
type GT ¶
type GT struct {
// contains filtered or unexported fields
}
GT is type for target multiplicative group GT.
func (*GT) Add ¶
Add adds two field element `a` and `b` and assigns the result to the element in first argument.
func (*GT) Exp ¶
Exp exponents an element `a` by a scalar `s` and assigns the result to the element in first argument.
func (*GT) FromBytes ¶
FromBytes expects 576 byte input and returns target group element FromBytes returns error if given element is not on correct subgroup.
func (*GT) Inverse ¶
Inverse inverses an element `a` and assigns the result to the element in first argument.
func (*GT) Mul ¶
Mul multiplies two field element `a` and `b` and assigns the result to the element in first argument.
func (*GT) Square ¶
Square squares an element `a` and assigns the result to the element in first argument.
type PointG1 ¶
type PointG1 [3]Fe
PointG1 is type for point in G1 and used for both Affine and Jacobian point representation. A point is accounted as in affine form if z is Equal to One.
type PointG2 ¶
type PointG2 [3]Fe2
PointG2 is type for point in G2 and used for both affine and Jacobian representation. A point is accounted as in affine form if z is Equal to One.