github.com/cloudflare/circl@v1.5.0/ecc/bls12381/gt.go (about)

     1  package bls12381
     2  
     3  import "github.com/cloudflare/circl/ecc/bls12381/ff"
     4  
     5  // GtSize is the length in bytes of an element in Gt.
     6  const GtSize = ff.URootSize
     7  
     8  // Gt represents an element of the output (multiplicative) group of a pairing.
     9  type Gt struct{ i ff.URoot }
    10  
    11  func (z Gt) String() string                  { return z.i.String() }
    12  func (z *Gt) UnmarshalBinary(b []byte) error { return z.i.UnmarshalBinary(b) }
    13  func (z Gt) MarshalBinary() ([]byte, error)  { return z.i.MarshalBinary() }
    14  func (z *Gt) SetIdentity()                   { z.i.SetIdentity() }
    15  func (z Gt) IsEqual(x *Gt) bool              { return z.i.IsEqual(&x.i) == 1 }
    16  func (z Gt) IsIdentity() bool                { i := &Gt{}; i.SetIdentity(); return z.IsEqual(i) }
    17  func (z *Gt) Mul(x, y *Gt)                   { z.i.Mul(&x.i, &y.i) }
    18  func (z *Gt) Sqr(x *Gt)                      { z.i.Sqr(&x.i) }
    19  func (z *Gt) Inv(x *Gt)                      { z.i.Inv(&x.i) }
    20  
    21  // Exp calculates z=x^n, where n is the exponent in big-endian order.
    22  func (z *Gt) Exp(x *Gt, n *Scalar) { b, _ := n.MarshalBinary(); z.i.Exp(&x.i, b) }