Documentation ¶
Index ¶
- Constants
- Variables
- func AddNoCarry(a, b [6]uint64) (out [6]uint64)
- func AddWithCarry(a, b, carry uint64) (uint64, uint64)
- func CompareTwoPairings(P1 *G1Projective, Q1 *G2Projective, P2 *G1Projective, Q2 *G2Projective) bool
- func CompressG1(affine *G1Affine) [48]byte
- func CompressG2(affine *G2Affine) [96]byte
- func MACWithCarry(a, b, c, carry uint64) (out uint64, newCarry uint64)
- func MontReduce(hi, lo [6]uint64) [6]uint64
- func MultiplyFQRepr(a, b [6]uint64) (hi [6]uint64, lo [6]uint64)
- func SubNoBorrow(a, b [6]uint64) (out [6]uint64)
- func SubWithBorrow(a, b, borrow uint64) (uint64, uint64)
- type BitIterator
- type FQ
- func (f *FQ) AddAssign(other FQ)
- func (f FQ) Cmp(other FQ) int
- func (f FQ) Copy() FQ
- func (f *FQ) DivAssign(other FQ)
- func (f *FQ) DoubleAssign()
- func (f FQ) Equals(other FQ) bool
- func (f FQ) Exp(n FQRepr) FQ
- func (f FQ) Inverse() (FQ, bool)
- func (f *FQ) IsValid() bool
- func (f FQ) IsZero() bool
- func (f *FQ) Legendre() LegendreSymbol
- func (f *FQ) MulAssign(other FQ)
- func (f FQ) MulBits(b *FQRepr) FQ
- func (f FQ) MulBytes(b []byte) FQ
- func (f *FQ) NegAssign()
- func (f FQ) Parity() bool
- func (f FQ) Sqrt() (FQ, bool)
- func (f *FQ) SquareAssign()
- func (f FQ) String() string
- func (f *FQ) SubAssign(other FQ)
- func (f *FQ) ToRepr() FQRepr
- type FQ12
- func (f *FQ12) AddAssign(other *FQ12)
- func (f *FQ12) ConjugateAssign()
- func (f FQ12) Copy() *FQ12
- func (f *FQ12) DoubleAssign()
- func (f FQ12) Equals(other *FQ12) bool
- func (f FQ12) Exp(n FQRepr) *FQ12
- func (f *FQ12) FrobeniusMapAssign(power uint8)
- func (f *FQ12) InverseAssign() bool
- func (f *FQ12) IsZero() bool
- func (f *FQ12) MulAssign(other *FQ12)
- func (f *FQ12) MulBy014Assign(c0 FQ2, c1 FQ2, c4 FQ2)
- func (f *FQ12) NegAssign()
- func (f *FQ12) SquareAssign()
- func (f *FQ12) String() string
- func (f *FQ12) SubAssign(other *FQ12)
- type FQ2
- func (f *FQ2) AddAssign(other FQ2)
- func (f FQ2) Cmp(other FQ2) int
- func (f *FQ2) Copy() FQ2
- func (f *FQ2) DivAssign(other FQ2)
- func (f *FQ2) DoubleAssign()
- func (f FQ2) Equals(other FQ2) bool
- func (f FQ2) Exp(n FQRepr) FQ2
- func (f *FQ2) FrobeniusMapAssign(power uint8)
- func (f *FQ2) InverseAssign() bool
- func (f FQ2) IsZero() bool
- func (f FQ2) Legendre() LegendreSymbol
- func (f *FQ2) MulAssign(other FQ2)
- func (f FQ2) MulBits(b *big.Int) FQ2
- func (f *FQ2) MultiplyByNonresidueAssign()
- func (f *FQ2) NegAssign()
- func (f *FQ2) Norm() FQ
- func (f FQ2) Parity() bool
- func (f FQ2) Sqrt() (FQ2, bool)
- func (f *FQ2) SquareAssign()
- func (f FQ2) String() string
- func (f *FQ2) SubAssign(other FQ2)
- type FQ6
- func (f *FQ6) AddAssign(other *FQ6)
- func (f FQ6) Copy() *FQ6
- func (f *FQ6) DoubleAssign()
- func (f FQ6) Equals(other *FQ6) bool
- func (f FQ6) Exp(n *FQRepr) *FQ6
- func (f *FQ6) FrobeniusMapAssign(power uint8)
- func (f *FQ6) InverseAssign() bool
- func (f FQ6) IsZero() bool
- func (f *FQ6) MulAssign(other *FQ6)
- func (f *FQ6) MulBy01Assign(c0 FQ2, c1 FQ2)
- func (f *FQ6) MulBy1Assign(c1 FQ2)
- func (f *FQ6) MulByNonresidueAssign()
- func (f *FQ6) NegAssign()
- func (f *FQ6) SquareAssign()
- func (f FQ6) String() string
- func (f *FQ6) SubAssign(other *FQ6)
- type FQRepr
- func (f *FQRepr) AddNoCarry(g FQRepr)
- func (f FQRepr) Bit(n uint) bool
- func (f FQRepr) BitLen() uint
- func (f FQRepr) Bytes() [48]byte
- func (f *FQRepr) Cmp(g FQRepr) int
- func (f *FQRepr) Copy() FQRepr
- func (f *FQRepr) Div2()
- func (f *FQRepr) Equals(g FQRepr) bool
- func (f FQRepr) IsEven() bool
- func (f FQRepr) IsOdd() bool
- func (f FQRepr) IsZero() bool
- func (f *FQRepr) Lsh(n uint)
- func (f *FQRepr) Mul2()
- func (f *FQRepr) Rsh(n uint)
- func (f FQRepr) String() string
- func (f *FQRepr) SubNoBorrow(g FQRepr)
- func (f FQRepr) ToBig() *big.Int
- type FR
- func (f *FR) AddAssign(other *FR)
- func (f *FR) Bytes() [32]byte
- func (f FR) Cmp(other *FR) int
- func (f *FR) Copy() *FR
- func (f *FR) DoubleAssign()
- func (f FR) Equals(other *FR) bool
- func (f *FR) Exp(n *FRRepr) *FR
- func (f FR) Inverse() *FR
- func (f *FR) IsValid() bool
- func (f FR) IsZero() bool
- func (f *FR) Legendre() LegendreSymbol
- func (f FR) MulAssign(other *FR)
- func (f FR) MulBits(b *FRRepr) *FR
- func (f FR) MulBytes(b []byte) *FR
- func (f *FR) NegAssign()
- func (f FR) Parity() bool
- func (f FR) Sqrt() *FR
- func (f *FR) SquareAssign()
- func (f FR) String() string
- func (f *FR) SubAssign(other *FR)
- func (f *FR) ToRepr() *FRRepr
- type FRRepr
- func (f *FRRepr) AddNoCarry(g *FRRepr)
- func (f FRRepr) Bit(n uint) bool
- func (f FRRepr) BitLen() uint
- func (f FRRepr) Bytes() [32]byte
- func (f *FRRepr) Cmp(g *FRRepr) int
- func (f *FRRepr) Copy() *FRRepr
- func (f *FRRepr) Div2()
- func (f *FRRepr) Equals(g *FRRepr) bool
- func (f FRRepr) IsEven() bool
- func (f FRRepr) IsOdd() bool
- func (f FRRepr) IsZero() bool
- func (f *FRRepr) Lsh(n uint)
- func (f *FRRepr) Mul2()
- func (f *FRRepr) Rsh(n uint)
- func (f FRRepr) String() string
- func (f *FRRepr) SubNoBorrow(g *FRRepr)
- func (f FRRepr) ToBig() *big.Int
- func (f *FRRepr) ToFQ() FQRepr
- type G1Affine
- func (g G1Affine) Copy() *G1Affine
- func (g G1Affine) Equals(other *G1Affine) bool
- func (g G1Affine) IsInCorrectSubgroupAssumingOnCurve() bool
- func (g G1Affine) IsOnCurve() bool
- func (g G1Affine) IsZero() bool
- func (g G1Affine) Mul(b FQRepr) *G1Projective
- func (g G1Affine) MulFR(b *FRRepr) *G1Projective
- func (g *G1Affine) NegAssign()
- func (g G1Affine) ScaleByCofactor() *G1Projective
- func (g *G1Affine) SerializeBytes() [96]byte
- func (g *G1Affine) SetRawBytes(uncompressed [96]byte)
- func (g G1Affine) String() string
- func (g G1Affine) ToProjective() *G1Projective
- type G1Projective
- func (g G1Projective) Add(other *G1Projective) *G1Projective
- func (g G1Projective) AddAffine(other *G1Affine) *G1Projective
- func (g G1Projective) Copy() *G1Projective
- func (g G1Projective) Double() *G1Projective
- func (g G1Projective) Equal(other *G1Projective) bool
- func (g G1Projective) IsZero() bool
- func (g G1Projective) Mul(b FQRepr) *G1Projective
- func (g G1Projective) MulFR(b *FRRepr) *G1Projective
- func (g *G1Projective) NegAssign()
- func (g G1Projective) String() string
- func (g G1Projective) ToAffine() *G1Affine
- type G2Affine
- func DecompressG2(c [96]byte) (*G2Affine, error)
- func DecompressG2Unchecked(c [96]byte) (*G2Affine, error)
- func GetG2PointFromX(x FQ2, greatest bool) (*G2Affine, error)
- func HashG2(msg []byte) *G2Affine
- func NewG2Affine(x FQ2, y FQ2) *G2Affine
- func OptimizedSWU2MapHelper(t FQ2) *G2Affine
- func SWEncodeG2(t FQ2) *G2Affine
- func (g G2Affine) Copy() *G2Affine
- func (g G2Affine) Equals(other *G2Affine) bool
- func (g G2Affine) IsInCorrectSubgroupAssumingOnCurve() bool
- func (g G2Affine) IsOnCurve() bool
- func (g G2Affine) IsZero() bool
- func (g G2Affine) Mul(b FQRepr) *G2Projective
- func (g G2Affine) MulBig(b big.Int) *G2Projective
- func (g G2Affine) MulFR(b *FRRepr) *G2Projective
- func (g *G2Affine) NegAssign()
- func (g G2Affine) ScaleByCofactor() *G2Projective
- func (g *G2Affine) SerializeBytes() [192]byte
- func (g *G2Affine) SetRawBytes(uncompressed [192]byte) error
- func (g G2Affine) String() string
- func (g G2Affine) ToProjective() *G2Projective
- type G2Prepared
- type G2Projective
- func (g G2Projective) Add(other *G2Projective) *G2Projective
- func (g G2Projective) AddAffine(other *G2Affine) *G2Projective
- func (g G2Projective) Copy() *G2Projective
- func (g G2Projective) Double() *G2Projective
- func (g G2Projective) Equals(other *G2Projective) bool
- func (g G2Projective) IsZero() bool
- func (g G2Projective) Mul(b FQRepr) *G2Projective
- func (g G2Projective) MulFR(b *FRRepr) *G2Projective
- func (g G2Projective) String() string
- func (g G2Projective) ToAffine() *G2Affine
- type LegendreSymbol
- type MillerLoopItem
Constants ¶
const ( // LegendreZero is the legendre symbol of zero. LegendreZero = LegendreSymbol(iota) // LegendreQuadraticResidue is the legendre symbol of quadratic residue. LegendreQuadraticResidue // LegendreQuadraticNonResidue is the legendre symbol of quadratic non-residue. LegendreQuadraticNonResidue )
Variables ¶
var BCoeff = FQReprToFQRaw(FQRepr{0xaa270000000cfff3, 0x53cc0032fc34000a, 0x478fe97a6b0a807f, 0xb1d37ebee6ba24d7, 0x8ec9733bbf78ab2f, 0x9d645513d83de7e})
BCoeff of the G1 curve.
var BCoeffFQ2 = NewFQ2(BCoeff, BCoeff)
BCoeffFQ2 of the G2 curve.
var FQ12One = NewFQ12(FQ6One, FQ6Zero)
FQ12One is the one element of FQ12.
var FQ12Zero = NewFQ12(FQ6Zero, FQ6Zero)
FQ12Zero is the zero element of FQ12.
var FQ2One = FQ2{ // contains filtered or unexported fields }
FQ2One gets the one-element of the field.
var FQ2Zero = FQ2{ // contains filtered or unexported fields }
FQ2Zero gets the zero element of the field.
var FQ6One = NewFQ6(FQ2One, FQ2Zero, FQ2Zero)
FQ6One represents the one value of FQ6.
var FQ6Zero = NewFQ6(FQ2Zero, FQ2Zero, FQ2Zero)
FQ6Zero represents the zero value of FQ6.
var FQOne = FQReprToFQ(bigOne)
FQOne is the one FQ element
var FQR2, _ = FQReprFromString("2708263910654730174793787626328176511836455197166317677006154293982164122222515399004018013397331347120527951271750", 10)
FQR2 is R^2 % Q.
var FQZero = FQReprToFQRaw(bigZero)
FQZero is the zero FQ element
var FRR, _ = FRReprFromString("10920338887063814464675503992315976177888879664585288394250266608035967270910", 10)
FRR is 2**256 % r used for moving numbers into Montgomery form.
var FRR2, _ = FRReprFromString("3294906474794265442129797520630710739278575682199800681788903916070560242797", 10)
FRR2 is R^2 % r.
var G1AffineOne = &G1Affine{FQReprToFQ(g1GeneratorX), FQReprToFQ(g1GeneratorY), false}
G1AffineOne represents the point at 1 on G1.
var G1AffineZero = &G1Affine{FQZero.Copy(), FQOne.Copy(), true}
G1AffineZero represents the point at infinity on G1.
var G1ProjectiveOne = G1AffineOne.ToProjective()
G1ProjectiveOne is the generator point on G1.
var G1ProjectiveZero = &G1Projective{FQZero.Copy(), FQOne.Copy(), FQZero.Copy()}
G1ProjectiveZero is the point at infinity where Z = 0.
var G2AffineOne = &G2Affine{ x: NewFQ2( FQReprToFQ(g2GeneratorXC0), FQReprToFQ(g2GeneratorXC1), ), y: NewFQ2( FQReprToFQ(g2GeneratorYC0), FQReprToFQ(g2GeneratorYC1), ), infinity: false}
G2AffineOne represents the point at 1 on G2.
var G2AffineZero = &G2Affine{FQ2Zero, FQ2One, true}
G2AffineZero represents the point at infinity on G2.
var G2ProjectiveOne = G2AffineOne.ToProjective()
G2ProjectiveOne is the generator point on G2.
var G2ProjectiveZero = &G2Projective{FQ2Zero.Copy(), FQ2One.Copy(), FQ2Zero.Copy()}
G2ProjectiveZero is the point at infinity where Z = 0.
var QFieldModulus, _ = FQReprFromString("4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", 10)
QFieldModulus is the modulus of the field.
var RFieldModulus, _ = FRReprFromString("52435875175126190479447740508185965837690552500527637822603658699938581184513", 10)
RFieldModulus is the modulus of the R field.
Functions ¶
func AddNoCarry ¶
func AddWithCarry ¶
func CompareTwoPairings ¶
func CompareTwoPairings(P1 *G1Projective, Q1 *G2Projective, P2 *G1Projective, Q2 *G2Projective) bool
CompareTwoPairings checks e(P1, Q1) == e(P2, Q2) <=> FE(ML(P1, Q1)ML(-P2, Q2)) == 1
func CompressG1 ¶
CompressG1 compresses a G1 point into an int.
func CompressG2 ¶
CompressG2 compresses a G2 point into an int.
func MACWithCarry ¶
func MontReduce ¶
func MultiplyFQRepr ¶
MultiplyFQRepr multiplies two FQRepr values together.
func SubNoBorrow ¶
func SubWithBorrow ¶
Types ¶
type BitIterator ¶
type BitIterator struct {
// contains filtered or unexported fields
}
BitIterator is an iterator through bits.
func NewBitIterator ¶
func NewBitIterator(arr []uint64) BitIterator
NewBitIterator creates a new bit iterator given an array of ints.
func (*BitIterator) Next ¶
func (bi *BitIterator) Next() (bool, bool)
Next returns the next bit in the bit iterator with the second return value as true when finished.
type FQ ¶
type FQ struct {
// contains filtered or unexported fields
}
FQ is an element in a field.
func FQReprToFQ ¶
FQReprToFQ gets a pointer to a FQ given a pointer to an FQRepr
func FQReprToFQRaw ¶
FQReprToFQRaw gets a pointer to a FQ without converting to montgomery form.
func (*FQ) Legendre ¶
func (f *FQ) Legendre() LegendreSymbol
Legendre gets the legendre symbol of the element.
func (*FQ) NegAssign ¶
func (f *FQ) NegAssign()
NegAssign gets the negative value of the field element mod QFieldModulus.
type FQ12 ¶
type FQ12 struct {
// contains filtered or unexported fields
}
FQ12 is an element of Fq12, represented by c0 + c1 * w.
func FinalExponentiation ¶
FinalExponentiation performs the final exponentiation on the FQ12 element.
func MillerLoop ¶
func MillerLoop(items []MillerLoopItem) *FQ12
MillerLoop runs the miller loop algorithm.
func Pairing ¶
func Pairing(p *G1Projective, q *G2Projective) *FQ12
Pairing performs a pairing given the G1 and G2 elements.
func (*FQ12) ConjugateAssign ¶
func (f *FQ12) ConjugateAssign()
ConjugateAssign returns the conjugate of the FQ12 element.
func (*FQ12) DoubleAssign ¶
func (f *FQ12) DoubleAssign()
DoubleAssign doubles each coefficient in an FQ12 element.
func (*FQ12) FrobeniusMapAssign ¶
FrobeniusMapAssign calculates the frobenius map of an FQ12 element.
func (*FQ12) InverseAssign ¶
InverseAssign finds the inverse of an FQ12
func (*FQ12) MulBy014Assign ¶
MulBy014Assign multiplies FQ12 element by 3 FQ2 elements.
type FQ2 ¶
type FQ2 struct {
// contains filtered or unexported fields
}
FQ2 represents an element of Fq2, represented by c0 + c1 * u.
func (*FQ2) FrobeniusMapAssign ¶
FrobeniusMapAssign multiplies the element by the Frobenius automorphism coefficient.
func (*FQ2) InverseAssign ¶
InverseAssign finds the inverse of the field element.
func (FQ2) Legendre ¶
func (f FQ2) Legendre() LegendreSymbol
Legendre gets the legendre symbol of the FQ2 element.
func (*FQ2) MultiplyByNonresidueAssign ¶
func (f *FQ2) MultiplyByNonresidueAssign()
MultiplyByNonresidueAssign multiplies this element by the cubic and quadratic nonresidue 1 + u.
type FQ6 ¶
type FQ6 struct {
// contains filtered or unexported fields
}
FQ6 is an element of FQ6 represented by c0 + c1*v + v2*v**2
func (*FQ6) DoubleAssign ¶
func (f *FQ6) DoubleAssign()
DoubleAssign doubles the coefficients of the FQ6 element.
func (*FQ6) FrobeniusMapAssign ¶
FrobeniusMapAssign runs the frobenius map algorithm with a certain power.
func (*FQ6) InverseAssign ¶
InverseAssign finds the inverse of the FQ6 element.
func (*FQ6) MulBy01Assign ¶
MulBy01Assign multiplies by c0 and c1.
func (*FQ6) MulBy1Assign ¶
MulBy1Assign multiplies the FQ6 by an FQ2.
func (*FQ6) MulByNonresidueAssign ¶
func (f *FQ6) MulByNonresidueAssign()
MulByNonresidueAssign multiplies by quadratic nonresidue v.
type FQRepr ¶
type FQRepr [6]uint64
FQRepr represents a uint384. The least significant bits are first.
func FQReprFromBigInt ¶
FQReprFromBigInt create a FQRepr from a big.Int.
func FQReprFromBytes ¶
FQReprFromBytes gets a new FQRepr from big-endian bytes.
func FQReprFromString ¶
FQReprFromString creates a FQRepr from a string.
func (*FQRepr) AddNoCarry ¶
AddNoCarry adds two FQReprs to another and does not handle carry.
func (*FQRepr) SubNoBorrow ¶
SubNoBorrow subtracts two FQReprs from another and does not handle borrow.
type FR ¶
type FR struct {
// contains filtered or unexported fields
}
FR is an element in a field.
func FRReprToFR ¶
FRReprToFR gets a pointer to a FR given a pointer to an FRRepr
func HashSecretKey ¶
func (*FR) Legendre ¶
func (f *FR) Legendre() LegendreSymbol
Legendre gets the legendre symbol of the element.
func (*FR) NegAssign ¶
func (f *FR) NegAssign()
NegAssign gets the negative value of the field element mod RFieldModulus.
type FRRepr ¶
type FRRepr [4]uint64
FRRepr represents a uint256.
func FRReprFromBigInt ¶
FRReprFromBigInt create a FRRepr from a big.Int.
func FRReprFromBytes ¶
FRReprFromBytes gets a new FRRepr from big-endian bytes.
func FRReprFromString ¶
FRReprFromString creates a FRRepr from a string.
func (*FRRepr) AddNoCarry ¶
AddNoCarry adds two FRReprs to another and does not handle carry.
func (*FRRepr) SubNoBorrow ¶
SubNoBorrow subtracts two FRReprs from another and does not handle borrow.
type G1Affine ¶
type G1Affine struct {
// contains filtered or unexported fields
}
G1Affine is an affine point on the G1 curve.
func DecompressG1 ¶
DecompressG1 decompresses the big int into an affine point and checks if it is in the correct prime group.
func DecompressG1Unchecked ¶
DecompressG1Unchecked decompresses the big int into an affine point without checking if it's in the correct prime group.
func GetG1PointFromX ¶
GetG1PointFromX attempts to reconstruct an affine point given an x-coordinate. The point is not guaranteed to be in the subgroup. If and only if `greatest` is set will the lexicographically largest y-coordinate be selected.
func NewG1Affine ¶
NewG1Affine constructs a new G1Affine point.
func (G1Affine) IsInCorrectSubgroupAssumingOnCurve ¶
IsInCorrectSubgroupAssumingOnCurve checks if the point multiplied by the field characteristic equals zero.
func (G1Affine) Mul ¶
func (g G1Affine) Mul(b FQRepr) *G1Projective
Mul performs a EC multiply operation on the point.
func (G1Affine) MulFR ¶
func (g G1Affine) MulFR(b *FRRepr) *G1Projective
MulFR performs a EC multiply operation on the point.
func (G1Affine) ScaleByCofactor ¶
func (g G1Affine) ScaleByCofactor() *G1Projective
ScaleByCofactor scales the G1Affine point by the cofactor.
func (*G1Affine) SerializeBytes ¶
SerializeBytes returns the serialized bytes for the point represented.
func (*G1Affine) SetRawBytes ¶
SetRawBytes sets the coords given the serialized bytes.
func (G1Affine) ToProjective ¶
func (g G1Affine) ToProjective() *G1Projective
ToProjective converts an affine point to a projective one.
type G1Projective ¶
type G1Projective struct {
// contains filtered or unexported fields
}
G1Projective is a projective point on the G1 curve.
func NewG1Projective ¶
func NewG1Projective(x FQ, y FQ, z FQ) *G1Projective
NewG1Projective creates a new G1Projective point.
func (G1Projective) Add ¶
func (g G1Projective) Add(other *G1Projective) *G1Projective
Add performs an EC Add operation with another point.
func (G1Projective) AddAffine ¶
func (g G1Projective) AddAffine(other *G1Affine) *G1Projective
AddAffine performs an EC Add operation with an affine point.
func (G1Projective) Copy ¶
func (g G1Projective) Copy() *G1Projective
Copy returns a copy of the G1Projective point.
func (G1Projective) Double ¶
func (g G1Projective) Double() *G1Projective
Double performs EC doubling on the point.
func (G1Projective) Equal ¶
func (g G1Projective) Equal(other *G1Projective) bool
Equal checks if two projective points are equal.
func (G1Projective) IsZero ¶
func (g G1Projective) IsZero() bool
IsZero checks if the G1Projective point is zero.
func (G1Projective) Mul ¶
func (g G1Projective) Mul(b FQRepr) *G1Projective
Mul performs a EC multiply operation on the point.
func (G1Projective) MulFR ¶
func (g G1Projective) MulFR(b *FRRepr) *G1Projective
MulFR performs a EC multiply operation on the point.
func (G1Projective) String ¶
func (g G1Projective) String() string
func (G1Projective) ToAffine ¶
func (g G1Projective) ToAffine() *G1Affine
ToAffine converts a G1Projective point to affine form.
type G2Affine ¶
type G2Affine struct {
// contains filtered or unexported fields
}
G2Affine is an affine point on the G2 curve.
func DecompressG2 ¶
DecompressG2 decompresses a G2 point from a big int and checks if it is in the correct subgroup.
func DecompressG2Unchecked ¶
DecompressG2Unchecked decompresses a G2 point from a big int.
func GetG2PointFromX ¶
GetG2PointFromX attempts to reconstruct an affine point given an x-coordinate. The point is not guaranteed to be in the subgroup. If and only if `greatest` is set will the lexicographically largest y-coordinate be selected.
func NewG2Affine ¶
NewG2Affine constructs a new G2Affine point.
func OptimizedSWU2MapHelper ¶
func SWEncodeG2 ¶
SWEncodeG2 implements the Shallue-van de Woestijne encoding.
func (G2Affine) IsInCorrectSubgroupAssumingOnCurve ¶
IsInCorrectSubgroupAssumingOnCurve checks if the point multiplied by the field characteristic equals zero.
func (G2Affine) Mul ¶
func (g G2Affine) Mul(b FQRepr) *G2Projective
Mul performs a EC multiply operation on the point.
func (G2Affine) MulBig ¶
func (g G2Affine) MulBig(b big.Int) *G2Projective
MulBig performs a EC multiply operation on the point.
func (G2Affine) MulFR ¶
func (g G2Affine) MulFR(b *FRRepr) *G2Projective
MulFR performs a EC multiply operation on the point.
func (G2Affine) ScaleByCofactor ¶
func (g G2Affine) ScaleByCofactor() *G2Projective
ScaleByCofactor scales the G2Affine point by the cofactor.
func (*G2Affine) SerializeBytes ¶
SerializeBytes returns the serialized bytes for the points represented.
func (*G2Affine) SetRawBytes ¶
SetRawBytes sets the coords given the serialized bytes.
func (G2Affine) ToProjective ¶
func (g G2Affine) ToProjective() *G2Projective
ToProjective converts an affine point to a projective one.
type G2Prepared ¶
type G2Prepared struct {
// contains filtered or unexported fields
}
G2Prepared is a prepared G2 point multiplication by blsX.
func G2AffineToPrepared ¶
func G2AffineToPrepared(q *G2Affine) *G2Prepared
G2AffineToPrepared performs multiplication of the affine point by blsX.
func (G2Prepared) IsZero ¶
func (g G2Prepared) IsZero() bool
IsZero checks if the point is at infinity.
type G2Projective ¶
type G2Projective struct {
// contains filtered or unexported fields
}
G2Projective is a projective point on the G2 curve.
func HashG2WithDomain ¶
func HashG2WithDomain(messageHash [32]byte, domain [8]byte) *G2Projective
Warning: See BLS standardisation process. This implementation is known to be unsecure.
func NewG2Projective ¶
func NewG2Projective(x FQ2, y FQ2, z FQ2) *G2Projective
NewG2Projective creates a new G2Projective point.
func (G2Projective) Add ¶
func (g G2Projective) Add(other *G2Projective) *G2Projective
Add performs an EC Add operation with another point.
func (G2Projective) AddAffine ¶
func (g G2Projective) AddAffine(other *G2Affine) *G2Projective
AddAffine performs an EC Add operation with an affine point.
func (G2Projective) Copy ¶
func (g G2Projective) Copy() *G2Projective
Copy returns a copy of the G2Projective point.
func (G2Projective) Double ¶
func (g G2Projective) Double() *G2Projective
Double performs EC doubling on the point.
func (G2Projective) Equals ¶
func (g G2Projective) Equals(other *G2Projective) bool
Equal checks if two projective points are equal.
func (G2Projective) IsZero ¶
func (g G2Projective) IsZero() bool
IsZero checks if the G2Projective point is zero.
func (G2Projective) Mul ¶
func (g G2Projective) Mul(b FQRepr) *G2Projective
Mul performs a EC multiply operation on the point.
func (G2Projective) MulFR ¶
func (g G2Projective) MulFR(b *FRRepr) *G2Projective
MulFR performs a EC multiply operation on the point.
func (G2Projective) String ¶
func (g G2Projective) String() string
func (G2Projective) ToAffine ¶
func (g G2Projective) ToAffine() *G2Affine
ToAffine converts a G2Projective point to affine form.
type LegendreSymbol ¶
type LegendreSymbol uint8
LegendreSymbol is the legendre symbol of an element.
type MillerLoopItem ¶
type MillerLoopItem struct { P *G1Affine Q *G2Prepared }
MillerLoopItem are the inputs to the miller loop.