curves

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

README

curves

import "github.com/coinbase/kryptology/pkg/core/curves"

This implementation IS NOT constant time as it leverages math/big for big number operations.

Index

Constants

const (
    K256Name       = "secp256k1"
    BLS12381G1Name = "BLS12381G1"
    BLS12381G2Name = "BLS12381G2"
    BLS12831Name   = "BLS12831"
    P256Name       = "P-256"
    ED25519Name    = "ed25519"
    PallasName     = "pallas"
    BLS12377G1Name = "BLS12377G1"
    BLS12377G2Name = "BLS12377G2"
    BLS12377Name   = "BLS12377"
)

func Ed25519Order

func Ed25519Order() *big.Int

SubgroupOrder returns the order of the Ed25519 base Point.

func VerifyEcdsa

func VerifyEcdsa(pk *EcPoint, hash []byte, sig *EcdsaSignature) bool

Verifies ECDSA signature using core types.

type Bls12381Scalar

type Bls12381Scalar struct{}
func NewBls12381Scalar
func NewBls12381Scalar() *Bls12381Scalar
func (Bls12381Scalar) Add
func (k Bls12381Scalar) Add(x, y *big.Int) *big.Int
func (Bls12381Scalar) Bytes
func (k Bls12381Scalar) Bytes(x *big.Int) []byte
func (Bls12381Scalar) Div
func (k Bls12381Scalar) Div(x, y *big.Int) *big.Int
func (Bls12381Scalar) Hash
func (k Bls12381Scalar) Hash(input []byte) *big.Int
func (Bls12381Scalar) IsValid
func (k Bls12381Scalar) IsValid(x *big.Int) bool
func (Bls12381Scalar) Mul
func (k Bls12381Scalar) Mul(x, y *big.Int) *big.Int
func (Bls12381Scalar) Neg
func (k Bls12381Scalar) Neg(x *big.Int) *big.Int
func (Bls12381Scalar) Random
func (k Bls12381Scalar) Random() (*big.Int, error)
func (Bls12381Scalar) Sub
func (k Bls12381Scalar) Sub(x, y *big.Int) *big.Int

type Curve

Curve represents a named elliptic curve with a scalar field and point group

type Curve struct {
    Scalar Scalar
    Point  Point
    Name   string
}
func BLS12377G1
func BLS12377G1() *Curve

BLS12377G1 returns the BLS12-377 curve with points in G1

func BLS12377G2
func BLS12377G2() *Curve

BLS12377G2 returns the BLS12-377 curve with points in G2

func BLS12381G1
func BLS12381G1() *Curve

BLS12381G1 returns the BLS12-381 curve with points in G1

func BLS12381G2
func BLS12381G2() *Curve

BLS12381G2 returns the BLS12-381 curve with points in G2

func ED25519
func ED25519() *Curve
func GetCurveByName
func GetCurveByName(name string) *Curve

GetCurveByName returns the correct `Curve` given the name

func K256
func K256() *Curve

K256 returns the secp256k1 curve

func P256
func P256() *Curve
func PALLAS
func PALLAS() *Curve
func (Curve) NewGeneratorPoint
func (c Curve) NewGeneratorPoint() Point
func (Curve) NewIdentityPoint
func (c Curve) NewIdentityPoint() Point
func (Curve) NewScalar
func (c Curve) NewScalar() Scalar
func (Curve) ScalarBaseMult
func (c Curve) ScalarBaseMult(sc Scalar) Point

type EcPoint

EcPoint represents an elliptic curve Point

type EcPoint struct {
    Curve elliptic.Curve
    X, Y  *big.Int
}
func NewScalarBaseMult
func NewScalarBaseMult(curve elliptic.Curve, k *big.Int) (*EcPoint, error)

NewScalarBaseMult creates a Point from the base Point multiplied by a field element

func PointFromBytesUncompressed
func PointFromBytesUncompressed(curve elliptic.Curve, b []byte) (*EcPoint, error)

PointFromBytesUncompressed outputs uncompressed X || Y similar to https://www.secg.org/sec1-v1.99.dif.pdf section 2.2 and 2.3

func (*EcPoint) Add
func (a *EcPoint) Add(b *EcPoint) (*EcPoint, error)

Add performs elliptic curve addition on two points

func (EcPoint) Bytes
func (a EcPoint) Bytes() []byte

Bytes returns the bytes represented by this Point with x || y

func (EcPoint) Equals
func (a EcPoint) Equals(b *EcPoint) bool

Equals return true if a + b have the same x,y coordinates

func (EcPoint) IsBasePoint
func (a EcPoint) IsBasePoint() bool

IsBasePoint returns true if this Point is curve's base Point

func (EcPoint) IsIdentity
func (a EcPoint) IsIdentity() bool

IsIdentity returns true if this Point is the Point at infinity

func (EcPoint) IsOnCurve
func (a EcPoint) IsOnCurve() bool
func (EcPoint) IsValid
func (a EcPoint) IsValid() bool
func (*EcPoint) MarshalBinary
func (a *EcPoint) MarshalBinary() ([]byte, error)
func (EcPoint) MarshalJSON
func (a EcPoint) MarshalJSON() ([]byte, error)

MarshalJSON serializes

func (*EcPoint) Neg
func (a *EcPoint) Neg() (*EcPoint, error)

Neg returns the negation of a Weierstrass Point.

func (*EcPoint) ScalarMult
func (a *EcPoint) ScalarMult(k *big.Int) (*EcPoint, error)

ScalarMult multiplies this Point by a Scalar

func (*EcPoint) UnmarshalBinary
func (a *EcPoint) UnmarshalBinary(data []byte) error
func (*EcPoint) UnmarshalJSON
func (a *EcPoint) UnmarshalJSON(bytes []byte) error

type EcPointJson

EcPointJson encapsulates the data that is serialized to JSON used internally and not for external use. Public so other pieces can use for serialization

type EcPointJson struct {
    CurveName string
    X, Y      *big.Int
}

type EcScalar

type EcScalar interface {
    Add(x, y *big.Int) *big.Int
    Sub(x, y *big.Int) *big.Int
    Neg(x *big.Int) *big.Int
    Mul(x, y *big.Int) *big.Int
    Hash(input []byte) *big.Int
    Div(x, y *big.Int) *big.Int
    Random() (*big.Int, error)
    IsValid(x *big.Int) bool
    Bytes(x *big.Int) []byte // fixed-length byte array
}

type EcdsaSignature

EcdsaSignature represents a (composite) digital signature

type EcdsaSignature struct {
    V    int
    R, S *big.Int
}

type EcdsaVerify

EcdsaVerify runs a curve- or algorithm-specific ECDSA verification function on input an ECDSA public (verification) key, a message digest, and an ECDSA signature. It must return true if all the parameters are sane and the ECDSA signature is valid, and false otherwise

type EcdsaVerify func(pubKey *EcPoint, hash []byte, signature *EcdsaSignature) bool

type Ed25519Scalar

type Ed25519Scalar struct{}
func NewEd25519Scalar
func NewEd25519Scalar() *Ed25519Scalar
func (Ed25519Scalar) Add
func (k Ed25519Scalar) Add(x, y *big.Int) *big.Int
func (Ed25519Scalar) Bytes
func (k Ed25519Scalar) Bytes(x *big.Int) []byte
func (Ed25519Scalar) Div
func (k Ed25519Scalar) Div(x, y *big.Int) *big.Int
func (Ed25519Scalar) Hash
func (k Ed25519Scalar) Hash(input []byte) *big.Int
func (Ed25519Scalar) IsValid
func (k Ed25519Scalar) IsValid(x *big.Int) bool
func (Ed25519Scalar) Mul
func (k Ed25519Scalar) Mul(x, y *big.Int) *big.Int
func (Ed25519Scalar) Neg
func (k Ed25519Scalar) Neg(x *big.Int) *big.Int
func (Ed25519Scalar) Random
func (k Ed25519Scalar) Random() (*big.Int, error)
func (Ed25519Scalar) RandomWithReader
func (k Ed25519Scalar) RandomWithReader(r io.Reader) (*big.Int, error)
func (Ed25519Scalar) Sub
func (k Ed25519Scalar) Sub(x, y *big.Int) *big.Int

type Element

Element is a group element within a finite field.

type Element struct {
    Modulus *Field   `json:"modulus"`
    Value   *big.Int `json:"value"`
}
func (Element) Add
func (x Element) Add(y *Element) *Element

Add returns the sum x+y

func (Element) BigInt
func (x Element) BigInt() *big.Int

BigInt returns value as a big.Int

func (Element) Bytes
func (x Element) Bytes() []byte

Bytes returns the value as bytes

func (Element) Clone
func (x Element) Clone() *Element

Clone returns a new copy of the element

func (Element) Div
func (x Element) Div(y *Element) *Element

Div returns the quotient x/y

func (Element) Field
func (x Element) Field() *Field
func (Element) Invert
func (x Element) Invert() *Element
func (Element) IsEqual
func (x Element) IsEqual(y *Element) bool

IsEqual returns x == y

func (*Element) MarshalJSON
func (x *Element) MarshalJSON() ([]byte, error)

Marshal Element to JSON

func (Element) Mul
func (x Element) Mul(y *Element) *Element

Mul returns the product x*y

func (Element) Neg
func (x Element) Neg() *Element

Neg returns the field negation

func (Element) Pow
func (x Element) Pow(y *Element) *Element

Pow computes x^y reduced by the modulus

func (Element) Sqrt
func (x Element) Sqrt() *Element
func (Element) Sub
func (x Element) Sub(y *Element) *Element

Sub returns the difference x-y

func (*Element) UnmarshalJSON
func (x *Element) UnmarshalJSON(bytes []byte) error

type ElementJSON

ElementJSON is used in JSON<>Element conversions. For years, big.Int hasn't properly supported JSON unmarshaling https://github.com/golang/go/issues/28154

type ElementJSON struct {
    Modulus string `json:"modulus"`
    Value   string `json:"value"`
}

type Ep

type Ep struct {
    // contains filtered or unexported fields
}
func (*Ep) Add
func (p *Ep) Add(lhs *Ep, rhs *Ep) *Ep
func (*Ep) CMove
func (p *Ep) CMove(lhs, rhs *Ep, condition int) *Ep
func (Ep) CurveName
func (p Ep) CurveName() string
func (*Ep) Double
func (p *Ep) Double(other *Ep) *Ep
func (*Ep) Equal
func (p *Ep) Equal(other *Ep) bool
func (*Ep) FromAffineCompressed
func (p *Ep) FromAffineCompressed(bytes []byte) (*Ep, error)
func (*Ep) FromAffineUncompressed
func (p *Ep) FromAffineUncompressed(bytes []byte) (*Ep, error)
func (*Ep) Generator
func (p *Ep) Generator() *Ep
func (*Ep) Hash
func (p *Ep) Hash(bytes []byte) *Ep
func (*Ep) Identity
func (p *Ep) Identity() *Ep
func (*Ep) IsIdentity
func (p *Ep) IsIdentity() bool
func (*Ep) IsOnCurve
func (p *Ep) IsOnCurve() bool
func (*Ep) Mul
func (p *Ep) Mul(point *Ep, scalar *fq.Fq) *Ep
func (*Ep) Neg
func (p *Ep) Neg(other *Ep) *Ep
func (*Ep) Random
func (p *Ep) Random(reader io.Reader) *Ep
func (*Ep) Set
func (p *Ep) Set(other *Ep) *Ep
func (*Ep) Sub
func (p *Ep) Sub(lhs, rhs *Ep) *Ep
func (Ep) SumOfProducts
func (p Ep) SumOfProducts(points []*Ep, scalars []Scalar) *Ep
func (*Ep) ToAffineCompressed
func (p *Ep) ToAffineCompressed() []byte
func (*Ep) ToAffineUncompressed
func (p *Ep) ToAffineUncompressed() []byte
func (*Ep) X
func (p *Ep) X() *fp.Fp
func (*Ep) Y
func (p *Ep) Y() *fp.Fp

type Field

Field is a finite field.

type Field struct {
    *big.Int
}
func NewField
func NewField(modulus *big.Int) *Field

New is a constructor for a Field.

func (Field) ElementFromBytes
func (f Field) ElementFromBytes(bytes []byte) *Element

ElementFromBytes initializes a new field element from big-endian bytes

func (Field) IsValid
func (f Field) IsValid(value *big.Int) bool

IsValid returns whether or not the value is within [0, modulus)

func (Field) NewElement
func (f Field) NewElement(value *big.Int) *Element
func (Field) One
func (f Field) One() *Element
func (Field) RandomElement
func (f Field) RandomElement(r io.Reader) (*Element, error)
func (Field) ReducedElementFromBytes
func (f Field) ReducedElementFromBytes(bytes []byte) *Element

ReducedElementFromBytes initializes a new field element from big-endian bytes and reduces it by the modulus of the field.

WARNING: If this is used with cryptographic constructions which rely on a uniform distribution of values, this may introduce a bias to the value of the returned field element. This happens when the integer range of the provided bytes is not an integer multiple of the field order.

Assume we are working in field which a modulus of 3 and the range of the uniform random bytes we provide as input is 5. Thus, the set of field elements is {0, 1, 2} and the set of integer values for the input bytes is: {0, 1, 2, 3, 4}. What is the distribution of the output values produced by this function?

ReducedElementFromBytes(0) => 0
ReducedElementFromBytes(1) => 1
ReducedElementFromBytes(2) => 2
ReducedElementFromBytes(3) => 0
ReducedElementFromBytes(4) => 1

For a value space V and random value v, a uniform distribution is defined as P[V = v] = 1/|V| where |V| is to the order of the field. Using the results from above, we see that P[v = 0] = 2/5, P[v = 1] = 2/5, and P[v = 2] = 1/5. For a uniform distribution we would expect these to each be equal to 1/3. As they do not, this does not return uniform output for that example.

To see why this is okay if the range is a multiple of the field order, change the input range to 6 and notice that now each output has a probability of 2/6 = 1/3, and the output is uniform.

func (Field) Zero
func (f Field) Zero() *Element

type K256Scalar

type K256Scalar struct{}
func NewK256Scalar
func NewK256Scalar() *K256Scalar
func (K256Scalar) Add
func (k K256Scalar) Add(x, y *big.Int) *big.Int
func (K256Scalar) Bytes
func (k K256Scalar) Bytes(x *big.Int) []byte
func (K256Scalar) Div
func (k K256Scalar) Div(x, y *big.Int) *big.Int
func (K256Scalar) Hash
func (k K256Scalar) Hash(input []byte) *big.Int
func (K256Scalar) IsValid
func (k K256Scalar) IsValid(x *big.Int) bool
func (K256Scalar) Mul
func (k K256Scalar) Mul(x, y *big.Int) *big.Int
func (K256Scalar) Neg
func (k K256Scalar) Neg(x *big.Int) *big.Int
func (K256Scalar) Random
func (k K256Scalar) Random() (*big.Int, error)
func (K256Scalar) Sub
func (k K256Scalar) Sub(x, y *big.Int) *big.Int

type P256Scalar

type P256Scalar struct{}
func NewP256Scalar
func NewP256Scalar() *P256Scalar
func (P256Scalar) Add
func (k P256Scalar) Add(x, y *big.Int) *big.Int
func (P256Scalar) Bytes
func (k P256Scalar) Bytes(x *big.Int) []byte
func (P256Scalar) Div
func (k P256Scalar) Div(x, y *big.Int) *big.Int
func (P256Scalar) Hash
func (k P256Scalar) Hash(input []byte) *big.Int
func (P256Scalar) IsValid
func (k P256Scalar) IsValid(x *big.Int) bool
func (P256Scalar) Mul
func (k P256Scalar) Mul(x, y *big.Int) *big.Int
func (P256Scalar) Neg
func (k P256Scalar) Neg(x *big.Int) *big.Int
func (P256Scalar) Random
func (k P256Scalar) Random() (*big.Int, error)
func (P256Scalar) Sub
func (k P256Scalar) Sub(x, y *big.Int) *big.Int

type PairingCurve

PairingCurve represents a named elliptic curve that supports pairings

type PairingCurve struct {
    Scalar  PairingScalar
    PointG1 PairingPoint
    PointG2 PairingPoint
    GT      Scalar
    Name    string
}
func BLS12381
func BLS12381(preferredPoint Point) *PairingCurve
func GetPairingCurveByName
func GetPairingCurveByName(name string) *PairingCurve
func (PairingCurve) NewG1GeneratorPoint
func (c PairingCurve) NewG1GeneratorPoint() PairingPoint
func (PairingCurve) NewG1IdentityPoint
func (c PairingCurve) NewG1IdentityPoint() PairingPoint
func (PairingCurve) NewG2GeneratorPoint
func (c PairingCurve) NewG2GeneratorPoint() PairingPoint
func (PairingCurve) NewG2IdentityPoint
func (c PairingCurve) NewG2IdentityPoint() PairingPoint
func (PairingCurve) NewScalar
func (c PairingCurve) NewScalar() PairingScalar
func (PairingCurve) ScalarG1BaseMult
func (c PairingCurve) ScalarG1BaseMult(sc Scalar) PairingPoint
func (PairingCurve) ScalarG2BaseMult
func (c PairingCurve) ScalarG2BaseMult(sc Scalar) PairingPoint

type PairingPoint

type PairingPoint interface {
    Point
    OtherGroup() PairingPoint
    Pairing(rhs PairingPoint) Scalar
    MultiPairing(...PairingPoint) Scalar
}

type PairingScalar

type PairingScalar interface {
    Scalar
    SetPoint(p Point) PairingScalar
}

type PallasCurve

type PallasCurve struct {
    *elliptic.CurveParams
}
func Pallas
func Pallas() *PallasCurve
func (*PallasCurve) Add
func (curve *PallasCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)
func (*PallasCurve) Double
func (curve *PallasCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)
func (*PallasCurve) IsOnCurve
func (curve *PallasCurve) IsOnCurve(x, y *big.Int) bool
func (*PallasCurve) Params
func (curve *PallasCurve) Params() *elliptic.CurveParams
func (*PallasCurve) ScalarBaseMult
func (curve *PallasCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)
func (*PallasCurve) ScalarMult
func (curve *PallasCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)

type PallasScalar

PallasScalar - Old interface

type PallasScalar struct{}
func NewPallasScalar
func NewPallasScalar() *PallasScalar
func (PallasScalar) Add
func (k PallasScalar) Add(x, y *big.Int) *big.Int
func (PallasScalar) Bytes
func (k PallasScalar) Bytes(x *big.Int) []byte
func (PallasScalar) Div
func (k PallasScalar) Div(x, y *big.Int) *big.Int
func (PallasScalar) Hash
func (k PallasScalar) Hash(input []byte) *big.Int
func (PallasScalar) IsValid
func (k PallasScalar) IsValid(x *big.Int) bool
func (PallasScalar) Mul
func (k PallasScalar) Mul(x, y *big.Int) *big.Int
func (PallasScalar) Neg
func (k PallasScalar) Neg(x *big.Int) *big.Int
func (PallasScalar) Random
func (k PallasScalar) Random() (*big.Int, error)
func (PallasScalar) Sub
func (k PallasScalar) Sub(x, y *big.Int) *big.Int

type Point

Point represents an elliptic curve point

type Point interface {
    encoding.BinaryMarshaler
    encoding.BinaryUnmarshaler
    encoding.TextMarshaler
    encoding.TextUnmarshaler
    json.Marshaler
    json.Unmarshaler
    Random(reader io.Reader) Point
    Hash(bytes []byte) Point
    Identity() Point
    Generator() Point
    IsIdentity() bool
    IsNegative() bool
    IsOnCurve() bool
    Double() Point
    Scalar() Scalar
    Neg() Point
    Add(rhs Point) Point
    Sub(rhs Point) Point
    Mul(rhs Scalar) Point
    Equal(rhs Point) bool
    Set(x, y *big.Int) (Point, error)
    ToAffineCompressed() []byte
    ToAffineUncompressed() []byte
    FromAffineCompressed(bytes []byte) (Point, error)
    FromAffineUncompressed(bytes []byte) (Point, error)
    CurveName() string
    SumOfProducts(points []Point, scalars []Scalar) Point
}

type PointBls12377G1

type PointBls12377G1 struct {
    // contains filtered or unexported fields
}
func (*PointBls12377G1) Add
func (p *PointBls12377G1) Add(rhs Point) Point
func (*PointBls12377G1) CurveName
func (p *PointBls12377G1) CurveName() string
func (*PointBls12377G1) Double
func (p *PointBls12377G1) Double() Point
func (*PointBls12377G1) Equal
func (p *PointBls12377G1) Equal(rhs Point) bool
func (*PointBls12377G1) FromAffineCompressed
func (p *PointBls12377G1) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointBls12377G1) FromAffineUncompressed
func (p *PointBls12377G1) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointBls12377G1) Generator
func (p *PointBls12377G1) Generator() Point
func (*PointBls12377G1) Hash
func (p *PointBls12377G1) Hash(bytes []byte) Point
func (*PointBls12377G1) Identity
func (p *PointBls12377G1) Identity() Point
func (*PointBls12377G1) IsIdentity
func (p *PointBls12377G1) IsIdentity() bool
func (*PointBls12377G1) IsNegative
func (p *PointBls12377G1) IsNegative() bool
func (*PointBls12377G1) IsOnCurve
func (p *PointBls12377G1) IsOnCurve() bool
func (*PointBls12377G1) MarshalBinary
func (p *PointBls12377G1) MarshalBinary() ([]byte, error)
func (*PointBls12377G1) MarshalJSON
func (p *PointBls12377G1) MarshalJSON() ([]byte, error)
func (*PointBls12377G1) MarshalText
func (p *PointBls12377G1) MarshalText() ([]byte, error)
func (*PointBls12377G1) Modulus
func (p *PointBls12377G1) Modulus() *big.Int
func (*PointBls12377G1) Mul
func (p *PointBls12377G1) Mul(rhs Scalar) Point
func (*PointBls12377G1) MultiPairing
func (p *PointBls12377G1) MultiPairing(points ...PairingPoint) Scalar
func (*PointBls12377G1) Neg
func (p *PointBls12377G1) Neg() Point
func (*PointBls12377G1) OtherGroup
func (p *PointBls12377G1) OtherGroup() PairingPoint
func (*PointBls12377G1) Pairing
func (p *PointBls12377G1) Pairing(rhs PairingPoint) Scalar
func (*PointBls12377G1) Random
func (p *PointBls12377G1) Random(reader io.Reader) Point
func (*PointBls12377G1) Scalar
func (p *PointBls12377G1) Scalar() Scalar
func (*PointBls12377G1) Set
func (p *PointBls12377G1) Set(x, y *big.Int) (Point, error)
func (*PointBls12377G1) Sub
func (p *PointBls12377G1) Sub(rhs Point) Point
func (*PointBls12377G1) SumOfProducts
func (p *PointBls12377G1) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointBls12377G1) ToAffineCompressed
func (p *PointBls12377G1) ToAffineCompressed() []byte
func (*PointBls12377G1) ToAffineUncompressed
func (p *PointBls12377G1) ToAffineUncompressed() []byte
func (*PointBls12377G1) UnmarshalBinary
func (p *PointBls12377G1) UnmarshalBinary(input []byte) error
func (*PointBls12377G1) UnmarshalJSON
func (p *PointBls12377G1) UnmarshalJSON(input []byte) error
func (*PointBls12377G1) UnmarshalText
func (p *PointBls12377G1) UnmarshalText(input []byte) error
func (*PointBls12377G1) X
func (p *PointBls12377G1) X() *big.Int
func (*PointBls12377G1) Y
func (p *PointBls12377G1) Y() *big.Int

type PointBls12377G2

type PointBls12377G2 struct {
    // contains filtered or unexported fields
}
func (*PointBls12377G2) Add
func (p *PointBls12377G2) Add(rhs Point) Point
func (*PointBls12377G2) CurveName
func (p *PointBls12377G2) CurveName() string
func (*PointBls12377G2) Double
func (p *PointBls12377G2) Double() Point
func (*PointBls12377G2) Equal
func (p *PointBls12377G2) Equal(rhs Point) bool
func (*PointBls12377G2) FromAffineCompressed
func (p *PointBls12377G2) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointBls12377G2) FromAffineUncompressed
func (p *PointBls12377G2) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointBls12377G2) Generator
func (p *PointBls12377G2) Generator() Point
func (*PointBls12377G2) Hash
func (p *PointBls12377G2) Hash(bytes []byte) Point
func (*PointBls12377G2) Identity
func (p *PointBls12377G2) Identity() Point
func (*PointBls12377G2) IsIdentity
func (p *PointBls12377G2) IsIdentity() bool
func (*PointBls12377G2) IsNegative
func (p *PointBls12377G2) IsNegative() bool
func (*PointBls12377G2) IsOnCurve
func (p *PointBls12377G2) IsOnCurve() bool
func (*PointBls12377G2) MarshalBinary
func (p *PointBls12377G2) MarshalBinary() ([]byte, error)
func (*PointBls12377G2) MarshalJSON
func (p *PointBls12377G2) MarshalJSON() ([]byte, error)
func (*PointBls12377G2) MarshalText
func (p *PointBls12377G2) MarshalText() ([]byte, error)
func (*PointBls12377G2) Modulus
func (p *PointBls12377G2) Modulus() *big.Int
func (*PointBls12377G2) Mul
func (p *PointBls12377G2) Mul(rhs Scalar) Point
func (*PointBls12377G2) MultiPairing
func (p *PointBls12377G2) MultiPairing(points ...PairingPoint) Scalar
func (*PointBls12377G2) Neg
func (p *PointBls12377G2) Neg() Point
func (*PointBls12377G2) OtherGroup
func (p *PointBls12377G2) OtherGroup() PairingPoint
func (*PointBls12377G2) Pairing
func (p *PointBls12377G2) Pairing(rhs PairingPoint) Scalar
func (*PointBls12377G2) Random
func (p *PointBls12377G2) Random(reader io.Reader) Point
func (*PointBls12377G2) Scalar
func (p *PointBls12377G2) Scalar() Scalar
func (*PointBls12377G2) Set
func (p *PointBls12377G2) Set(x, y *big.Int) (Point, error)
func (*PointBls12377G2) Sub
func (p *PointBls12377G2) Sub(rhs Point) Point
func (*PointBls12377G2) SumOfProducts
func (p *PointBls12377G2) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointBls12377G2) ToAffineCompressed
func (p *PointBls12377G2) ToAffineCompressed() []byte
func (*PointBls12377G2) ToAffineUncompressed
func (p *PointBls12377G2) ToAffineUncompressed() []byte
func (*PointBls12377G2) UnmarshalBinary
func (p *PointBls12377G2) UnmarshalBinary(input []byte) error
func (*PointBls12377G2) UnmarshalJSON
func (p *PointBls12377G2) UnmarshalJSON(input []byte) error
func (*PointBls12377G2) UnmarshalText
func (p *PointBls12377G2) UnmarshalText(input []byte) error
func (*PointBls12377G2) X
func (p *PointBls12377G2) X() *big.Int
func (*PointBls12377G2) Y
func (p *PointBls12377G2) Y() *big.Int

type PointBls12381G1

type PointBls12381G1 struct {
    // contains filtered or unexported fields
}
func (*PointBls12381G1) Add
func (p *PointBls12381G1) Add(rhs Point) Point
func (*PointBls12381G1) CurveName
func (p *PointBls12381G1) CurveName() string
func (*PointBls12381G1) Double
func (p *PointBls12381G1) Double() Point
func (*PointBls12381G1) Equal
func (p *PointBls12381G1) Equal(rhs Point) bool
func (*PointBls12381G1) FromAffineCompressed
func (p *PointBls12381G1) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointBls12381G1) FromAffineUncompressed
func (p *PointBls12381G1) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointBls12381G1) Generator
func (p *PointBls12381G1) Generator() Point
func (*PointBls12381G1) Hash
func (p *PointBls12381G1) Hash(bytes []byte) Point
func (*PointBls12381G1) Identity
func (p *PointBls12381G1) Identity() Point
func (*PointBls12381G1) IsIdentity
func (p *PointBls12381G1) IsIdentity() bool
func (*PointBls12381G1) IsNegative
func (p *PointBls12381G1) IsNegative() bool
func (*PointBls12381G1) IsOnCurve
func (p *PointBls12381G1) IsOnCurve() bool
func (*PointBls12381G1) MarshalBinary
func (p *PointBls12381G1) MarshalBinary() ([]byte, error)
func (*PointBls12381G1) MarshalJSON
func (p *PointBls12381G1) MarshalJSON() ([]byte, error)
func (*PointBls12381G1) MarshalText
func (p *PointBls12381G1) MarshalText() ([]byte, error)
func (*PointBls12381G1) Modulus
func (p *PointBls12381G1) Modulus() *big.Int
func (*PointBls12381G1) Mul
func (p *PointBls12381G1) Mul(rhs Scalar) Point
func (*PointBls12381G1) MultiPairing
func (p *PointBls12381G1) MultiPairing(points ...PairingPoint) Scalar
func (*PointBls12381G1) Neg
func (p *PointBls12381G1) Neg() Point
func (*PointBls12381G1) OtherGroup
func (p *PointBls12381G1) OtherGroup() PairingPoint
func (*PointBls12381G1) Pairing
func (p *PointBls12381G1) Pairing(rhs PairingPoint) Scalar
func (*PointBls12381G1) Random
func (p *PointBls12381G1) Random(reader io.Reader) Point
func (*PointBls12381G1) Scalar
func (p *PointBls12381G1) Scalar() Scalar
func (*PointBls12381G1) Set
func (p *PointBls12381G1) Set(x, y *big.Int) (Point, error)
func (*PointBls12381G1) Sub
func (p *PointBls12381G1) Sub(rhs Point) Point
func (*PointBls12381G1) SumOfProducts
func (p *PointBls12381G1) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointBls12381G1) ToAffineCompressed
func (p *PointBls12381G1) ToAffineCompressed() []byte
func (*PointBls12381G1) ToAffineUncompressed
func (p *PointBls12381G1) ToAffineUncompressed() []byte
func (*PointBls12381G1) UnmarshalBinary
func (p *PointBls12381G1) UnmarshalBinary(input []byte) error
func (*PointBls12381G1) UnmarshalJSON
func (p *PointBls12381G1) UnmarshalJSON(input []byte) error
func (*PointBls12381G1) UnmarshalText
func (p *PointBls12381G1) UnmarshalText(input []byte) error
func (*PointBls12381G1) X
func (p *PointBls12381G1) X() *big.Int
func (*PointBls12381G1) Y
func (p *PointBls12381G1) Y() *big.Int

type PointBls12381G2

type PointBls12381G2 struct {
    // contains filtered or unexported fields
}
func (*PointBls12381G2) Add
func (p *PointBls12381G2) Add(rhs Point) Point
func (*PointBls12381G2) CurveName
func (p *PointBls12381G2) CurveName() string
func (*PointBls12381G2) Double
func (p *PointBls12381G2) Double() Point
func (*PointBls12381G2) Equal
func (p *PointBls12381G2) Equal(rhs Point) bool
func (*PointBls12381G2) FromAffineCompressed
func (p *PointBls12381G2) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointBls12381G2) FromAffineUncompressed
func (p *PointBls12381G2) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointBls12381G2) Generator
func (p *PointBls12381G2) Generator() Point
func (*PointBls12381G2) Hash
func (p *PointBls12381G2) Hash(bytes []byte) Point
func (*PointBls12381G2) Identity
func (p *PointBls12381G2) Identity() Point
func (*PointBls12381G2) IsIdentity
func (p *PointBls12381G2) IsIdentity() bool
func (*PointBls12381G2) IsNegative
func (p *PointBls12381G2) IsNegative() bool
func (*PointBls12381G2) IsOnCurve
func (p *PointBls12381G2) IsOnCurve() bool
func (*PointBls12381G2) MarshalBinary
func (p *PointBls12381G2) MarshalBinary() ([]byte, error)
func (*PointBls12381G2) MarshalJSON
func (p *PointBls12381G2) MarshalJSON() ([]byte, error)
func (*PointBls12381G2) MarshalText
func (p *PointBls12381G2) MarshalText() ([]byte, error)
func (*PointBls12381G2) Modulus
func (p *PointBls12381G2) Modulus() *big.Int
func (*PointBls12381G2) Mul
func (p *PointBls12381G2) Mul(rhs Scalar) Point
func (*PointBls12381G2) MultiPairing
func (p *PointBls12381G2) MultiPairing(points ...PairingPoint) Scalar
func (*PointBls12381G2) Neg
func (p *PointBls12381G2) Neg() Point
func (*PointBls12381G2) OtherGroup
func (p *PointBls12381G2) OtherGroup() PairingPoint
func (*PointBls12381G2) Pairing
func (p *PointBls12381G2) Pairing(rhs PairingPoint) Scalar
func (*PointBls12381G2) Random
func (p *PointBls12381G2) Random(reader io.Reader) Point
func (*PointBls12381G2) Scalar
func (p *PointBls12381G2) Scalar() Scalar
func (*PointBls12381G2) Set
func (p *PointBls12381G2) Set(x, y *big.Int) (Point, error)
func (*PointBls12381G2) Sub
func (p *PointBls12381G2) Sub(rhs Point) Point
func (*PointBls12381G2) SumOfProducts
func (p *PointBls12381G2) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointBls12381G2) ToAffineCompressed
func (p *PointBls12381G2) ToAffineCompressed() []byte
func (*PointBls12381G2) ToAffineUncompressed
func (p *PointBls12381G2) ToAffineUncompressed() []byte
func (*PointBls12381G2) UnmarshalBinary
func (p *PointBls12381G2) UnmarshalBinary(input []byte) error
func (*PointBls12381G2) UnmarshalJSON
func (p *PointBls12381G2) UnmarshalJSON(input []byte) error
func (*PointBls12381G2) UnmarshalText
func (p *PointBls12381G2) UnmarshalText(input []byte) error
func (*PointBls12381G2) X
func (p *PointBls12381G2) X() *big.Int
func (*PointBls12381G2) Y
func (p *PointBls12381G2) Y() *big.Int

type PointEd25519

type PointEd25519 struct {
    // contains filtered or unexported fields
}
func (*PointEd25519) Add
func (p *PointEd25519) Add(rhs Point) Point
func (*PointEd25519) CurveName
func (p *PointEd25519) CurveName() string
func (*PointEd25519) Double
func (p *PointEd25519) Double() Point
func (*PointEd25519) Equal
func (p *PointEd25519) Equal(rhs Point) bool
func (*PointEd25519) FromAffineCompressed
func (p *PointEd25519) FromAffineCompressed(inBytes []byte) (Point, error)
func (*PointEd25519) FromAffineUncompressed
func (p *PointEd25519) FromAffineUncompressed(inBytes []byte) (Point, error)
func (*PointEd25519) Generator
func (p *PointEd25519) Generator() Point
func (*PointEd25519) GetEdwardsPoint
func (p *PointEd25519) GetEdwardsPoint() *edwards25519.Point
func (*PointEd25519) Hash
func (p *PointEd25519) Hash(bytes []byte) Point
func (*PointEd25519) Identity
func (p *PointEd25519) Identity() Point
func (*PointEd25519) IsIdentity
func (p *PointEd25519) IsIdentity() bool
func (*PointEd25519) IsNegative
func (p *PointEd25519) IsNegative() bool
func (*PointEd25519) IsOnCurve
func (p *PointEd25519) IsOnCurve() bool
func (*PointEd25519) MangleScalarBitsAndMulByBasepointToProducePublicKey
func (p *PointEd25519) MangleScalarBitsAndMulByBasepointToProducePublicKey(rhs *ScalarEd25519) *PointEd25519

MangleScalarBitsAndMulByBasepointToProducePublicKey is a function for mangling the bits of a (formerly mathematically well-defined) "scalar" and multiplying it to produce a public key.

func (*PointEd25519) MarshalBinary
func (p *PointEd25519) MarshalBinary() ([]byte, error)
func (*PointEd25519) MarshalJSON
func (p *PointEd25519) MarshalJSON() ([]byte, error)
func (*PointEd25519) MarshalText
func (p *PointEd25519) MarshalText() ([]byte, error)
func (*PointEd25519) Mul
func (p *PointEd25519) Mul(rhs Scalar) Point
func (*PointEd25519) Neg
func (p *PointEd25519) Neg() Point
func (*PointEd25519) Random
func (p *PointEd25519) Random(reader io.Reader) Point
func (*PointEd25519) Scalar
func (p *PointEd25519) Scalar() Scalar
func (*PointEd25519) Set
func (p *PointEd25519) Set(x, y *big.Int) (Point, error)
func (*PointEd25519) SetEdwardsPoint
func (p *PointEd25519) SetEdwardsPoint(pt *edwards25519.Point) *PointEd25519
func (*PointEd25519) Sub
func (p *PointEd25519) Sub(rhs Point) Point
func (*PointEd25519) SumOfProducts
func (p *PointEd25519) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointEd25519) ToAffineCompressed
func (p *PointEd25519) ToAffineCompressed() []byte
func (*PointEd25519) ToAffineUncompressed
func (p *PointEd25519) ToAffineUncompressed() []byte
func (*PointEd25519) UnmarshalBinary
func (p *PointEd25519) UnmarshalBinary(input []byte) error
func (*PointEd25519) UnmarshalJSON
func (p *PointEd25519) UnmarshalJSON(input []byte) error
func (*PointEd25519) UnmarshalText
func (p *PointEd25519) UnmarshalText(input []byte) error
func (*PointEd25519) VarTimeDoubleScalarBaseMult
func (p *PointEd25519) VarTimeDoubleScalarBaseMult(a Scalar, A Point, b Scalar) Point

type PointK256

type PointK256 struct {
    // contains filtered or unexported fields
}
func (*PointK256) Add
func (p *PointK256) Add(rhs Point) Point
func (*PointK256) CurveName
func (p *PointK256) CurveName() string
func (*PointK256) Double
func (p *PointK256) Double() Point
func (*PointK256) Equal
func (p *PointK256) Equal(rhs Point) bool
func (*PointK256) FromAffineCompressed
func (p *PointK256) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointK256) FromAffineUncompressed
func (p *PointK256) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointK256) Generator
func (p *PointK256) Generator() Point
func (*PointK256) Hash
func (p *PointK256) Hash(bytes []byte) Point
func (*PointK256) Identity
func (p *PointK256) Identity() Point
func (*PointK256) IsIdentity
func (p *PointK256) IsIdentity() bool
func (*PointK256) IsNegative
func (p *PointK256) IsNegative() bool
func (*PointK256) IsOnCurve
func (p *PointK256) IsOnCurve() bool
func (*PointK256) MarshalBinary
func (p *PointK256) MarshalBinary() ([]byte, error)
func (*PointK256) MarshalJSON
func (p *PointK256) MarshalJSON() ([]byte, error)
func (*PointK256) MarshalText
func (p *PointK256) MarshalText() ([]byte, error)
func (*PointK256) Mul
func (p *PointK256) Mul(rhs Scalar) Point
func (*PointK256) Neg
func (p *PointK256) Neg() Point
func (*PointK256) Params
func (p *PointK256) Params() *elliptic.CurveParams
func (*PointK256) Random
func (p *PointK256) Random(reader io.Reader) Point
func (*PointK256) Scalar
func (p *PointK256) Scalar() Scalar
func (*PointK256) Set
func (p *PointK256) Set(x, y *big.Int) (Point, error)
func (*PointK256) Sub
func (p *PointK256) Sub(rhs Point) Point
func (*PointK256) SumOfProducts
func (p *PointK256) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointK256) ToAffineCompressed
func (p *PointK256) ToAffineCompressed() []byte
func (*PointK256) ToAffineUncompressed
func (p *PointK256) ToAffineUncompressed() []byte
func (*PointK256) UnmarshalBinary
func (p *PointK256) UnmarshalBinary(input []byte) error
func (*PointK256) UnmarshalJSON
func (p *PointK256) UnmarshalJSON(input []byte) error
func (*PointK256) UnmarshalText
func (p *PointK256) UnmarshalText(input []byte) error
func (*PointK256) X
func (p *PointK256) X() *big.Int
func (*PointK256) Y
func (p *PointK256) Y() *big.Int

type PointP256

type PointP256 struct {
    // contains filtered or unexported fields
}
func (*PointP256) Add
func (p *PointP256) Add(rhs Point) Point
func (*PointP256) CurveName
func (p *PointP256) CurveName() string
func (*PointP256) Double
func (p *PointP256) Double() Point
func (*PointP256) Equal
func (p *PointP256) Equal(rhs Point) bool
func (*PointP256) FromAffineCompressed
func (p *PointP256) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointP256) FromAffineUncompressed
func (p *PointP256) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointP256) Generator
func (p *PointP256) Generator() Point
func (*PointP256) Hash
func (p *PointP256) Hash(bytes []byte) Point
func (*PointP256) Identity
func (p *PointP256) Identity() Point
func (*PointP256) IsIdentity
func (p *PointP256) IsIdentity() bool
func (*PointP256) IsNegative
func (p *PointP256) IsNegative() bool
func (*PointP256) IsOnCurve
func (p *PointP256) IsOnCurve() bool
func (*PointP256) MarshalBinary
func (p *PointP256) MarshalBinary() ([]byte, error)
func (*PointP256) MarshalJSON
func (p *PointP256) MarshalJSON() ([]byte, error)
func (*PointP256) MarshalText
func (p *PointP256) MarshalText() ([]byte, error)
func (*PointP256) Mul
func (p *PointP256) Mul(rhs Scalar) Point
func (*PointP256) Neg
func (p *PointP256) Neg() Point
func (*PointP256) Params
func (p *PointP256) Params() *elliptic.CurveParams
func (*PointP256) Random
func (p *PointP256) Random(reader io.Reader) Point
func (*PointP256) Scalar
func (p *PointP256) Scalar() Scalar
func (*PointP256) Set
func (p *PointP256) Set(x, y *big.Int) (Point, error)
func (*PointP256) Sub
func (p *PointP256) Sub(rhs Point) Point
func (*PointP256) SumOfProducts
func (p *PointP256) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointP256) ToAffineCompressed
func (p *PointP256) ToAffineCompressed() []byte
func (*PointP256) ToAffineUncompressed
func (p *PointP256) ToAffineUncompressed() []byte
func (*PointP256) UnmarshalBinary
func (p *PointP256) UnmarshalBinary(input []byte) error
func (*PointP256) UnmarshalJSON
func (p *PointP256) UnmarshalJSON(input []byte) error
func (*PointP256) UnmarshalText
func (p *PointP256) UnmarshalText(input []byte) error
func (*PointP256) X
func (p *PointP256) X() *big.Int
func (*PointP256) Y
func (p *PointP256) Y() *big.Int

type PointPallas

type PointPallas struct {
    // contains filtered or unexported fields
}
func (*PointPallas) Add
func (p *PointPallas) Add(rhs Point) Point
func (*PointPallas) CurveName
func (p *PointPallas) CurveName() string
func (*PointPallas) Double
func (p *PointPallas) Double() Point
func (*PointPallas) Equal
func (p *PointPallas) Equal(rhs Point) bool
func (*PointPallas) FromAffineCompressed
func (p *PointPallas) FromAffineCompressed(bytes []byte) (Point, error)
func (*PointPallas) FromAffineUncompressed
func (p *PointPallas) FromAffineUncompressed(bytes []byte) (Point, error)
func (*PointPallas) Generator
func (p *PointPallas) Generator() Point
func (*PointPallas) GetEp
func (p *PointPallas) GetEp() *Ep
func (*PointPallas) Hash
func (p *PointPallas) Hash(bytes []byte) Point
func (*PointPallas) Identity
func (p *PointPallas) Identity() Point
func (*PointPallas) IsIdentity
func (p *PointPallas) IsIdentity() bool
func (*PointPallas) IsNegative
func (p *PointPallas) IsNegative() bool
func (*PointPallas) IsOnCurve
func (p *PointPallas) IsOnCurve() bool
func (*PointPallas) MarshalBinary
func (p *PointPallas) MarshalBinary() ([]byte, error)
func (*PointPallas) MarshalJSON
func (p *PointPallas) MarshalJSON() ([]byte, error)
func (*PointPallas) MarshalText
func (p *PointPallas) MarshalText() ([]byte, error)
func (*PointPallas) Mul
func (p *PointPallas) Mul(rhs Scalar) Point
func (*PointPallas) Neg
func (p *PointPallas) Neg() Point
func (*PointPallas) Random
func (p *PointPallas) Random(reader io.Reader) Point
func (*PointPallas) Scalar
func (p *PointPallas) Scalar() Scalar
func (*PointPallas) Set
func (p *PointPallas) Set(x, y *big.Int) (Point, error)
func (*PointPallas) Sub
func (p *PointPallas) Sub(rhs Point) Point
func (*PointPallas) SumOfProducts
func (p *PointPallas) SumOfProducts(points []Point, scalars []Scalar) Point
func (*PointPallas) ToAffineCompressed
func (p *PointPallas) ToAffineCompressed() []byte
func (*PointPallas) ToAffineUncompressed
func (p *PointPallas) ToAffineUncompressed() []byte
func (*PointPallas) UnmarshalBinary
func (p *PointPallas) UnmarshalBinary(input []byte) error
func (*PointPallas) UnmarshalJSON
func (p *PointPallas) UnmarshalJSON(input []byte) error
func (*PointPallas) UnmarshalText
func (p *PointPallas) UnmarshalText(input []byte) error
func (*PointPallas) X
func (p *PointPallas) X() *fp.Fp
func (*PointPallas) Y
func (p *PointPallas) Y() *fp.Fp

type Scalar

Scalar represents an element of the scalar field \mathbb{F}_q of the elliptic curve construction.

type Scalar interface {
    encoding.BinaryMarshaler
    encoding.BinaryUnmarshaler
    encoding.TextMarshaler
    encoding.TextUnmarshaler
    json.Marshaler
    json.Unmarshaler
    // Random returns a random scalar using the provided reader
    // to retrieve bytes
    Random(reader io.Reader) Scalar
    // Hash the specific bytes in a manner to yield a
    // uniformly distributed scalar
    Hash(bytes []byte) Scalar
    // Zero returns the additive identity element
    Zero() Scalar
    // One returns the multiplicative identity element
    One() Scalar
    // IsZero returns true if this element is the additive identity element
    IsZero() bool
    // IsOne returns true if this element is the multiplicative identity element
    IsOne() bool
    // IsOdd returns true if this element is odd
    IsOdd() bool
    // IsEven returns true if this element is even
    IsEven() bool
    // New returns an element with the value equal to `value`
    New(value int) Scalar
    // Cmp returns
    // -2 if this element is in a different field than rhs
    // -1 if this element is less than rhs
    // 0 if this element is equal to rhs
    // 1 if this element is greater than rhs
    Cmp(rhs Scalar) int
    // Square returns element*element
    Square() Scalar
    // Double returns element+element
    Double() Scalar
    // Invert returns element^-1 mod p
    Invert() (Scalar, error)
    // Sqrt computes the square root of this element if it exists.
    Sqrt() (Scalar, error)
    // Cube returns element*element*element
    Cube() Scalar
    // Add returns element+rhs
    Add(rhs Scalar) Scalar
    // Sub returns element-rhs
    Sub(rhs Scalar) Scalar
    // Mul returns element*rhs
    Mul(rhs Scalar) Scalar
    // MulAdd returns element * y + z mod p
    MulAdd(y, z Scalar) Scalar
    // Div returns element*rhs^-1 mod p
    Div(rhs Scalar) Scalar
    // Neg returns -element mod p
    Neg() Scalar
    // SetBigInt returns this element set to the value of v
    SetBigInt(v *big.Int) (Scalar, error)
    // BigInt returns this element as a big integer
    BigInt() *big.Int
    // Point returns the associated point for this scalar
    Point() Point
    // Bytes returns the canonical byte representation of this scalar
    Bytes() []byte
    // SetBytes creates a scalar from the canonical representation expecting the exact number of bytes needed to represent the scalar
    SetBytes(bytes []byte) (Scalar, error)
    // SetBytesWide creates a scalar expecting double the exact number of bytes needed to represent the scalar which is reduced by the modulus
    SetBytesWide(bytes []byte) (Scalar, error)
    // Clone returns a cloned Scalar of this value
    Clone() Scalar
}

type ScalarBls12377

type ScalarBls12377 struct {
    // contains filtered or unexported fields
}
func (*ScalarBls12377) Add
func (s *ScalarBls12377) Add(rhs Scalar) Scalar
func (*ScalarBls12377) BigInt
func (s *ScalarBls12377) BigInt() *big.Int
func (*ScalarBls12377) Bytes
func (s *ScalarBls12377) Bytes() []byte
func (*ScalarBls12377) Clone
func (s *ScalarBls12377) Clone() Scalar
func (*ScalarBls12377) Cmp
func (s *ScalarBls12377) Cmp(rhs Scalar) int
func (*ScalarBls12377) Cube
func (s *ScalarBls12377) Cube() Scalar
func (*ScalarBls12377) Div
func (s *ScalarBls12377) Div(rhs Scalar) Scalar
func (*ScalarBls12377) Double
func (s *ScalarBls12377) Double() Scalar
func (*ScalarBls12377) Hash
func (s *ScalarBls12377) Hash(bytes []byte) Scalar
func (*ScalarBls12377) Invert
func (s *ScalarBls12377) Invert() (Scalar, error)
func (*ScalarBls12377) IsEven
func (s *ScalarBls12377) IsEven() bool
func (*ScalarBls12377) IsOdd
func (s *ScalarBls12377) IsOdd() bool
func (*ScalarBls12377) IsOne
func (s *ScalarBls12377) IsOne() bool
func (*ScalarBls12377) IsZero
func (s *ScalarBls12377) IsZero() bool
func (*ScalarBls12377) MarshalBinary
func (s *ScalarBls12377) MarshalBinary() ([]byte, error)
func (*ScalarBls12377) MarshalJSON
func (s *ScalarBls12377) MarshalJSON() ([]byte, error)
func (*ScalarBls12377) MarshalText
func (s *ScalarBls12377) MarshalText() ([]byte, error)
func (*ScalarBls12377) Mul
func (s *ScalarBls12377) Mul(rhs Scalar) Scalar
func (*ScalarBls12377) MulAdd
func (s *ScalarBls12377) MulAdd(y, z Scalar) Scalar
func (*ScalarBls12377) Neg
func (s *ScalarBls12377) Neg() Scalar
func (*ScalarBls12377) New
func (s *ScalarBls12377) New(value int) Scalar
func (*ScalarBls12377) One
func (s *ScalarBls12377) One() Scalar
func (*ScalarBls12377) Order
func (s *ScalarBls12377) Order() *big.Int
func (*ScalarBls12377) Point
func (s *ScalarBls12377) Point() Point
func (*ScalarBls12377) Random
func (s *ScalarBls12377) Random(reader io.Reader) Scalar
func (*ScalarBls12377) SetBigInt
func (s *ScalarBls12377) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarBls12377) SetBytes
func (s *ScalarBls12377) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarBls12377) SetBytesWide
func (s *ScalarBls12377) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarBls12377) SetPoint
func (s *ScalarBls12377) SetPoint(p Point) PairingScalar
func (*ScalarBls12377) Sqrt
func (s *ScalarBls12377) Sqrt() (Scalar, error)
func (*ScalarBls12377) Square
func (s *ScalarBls12377) Square() Scalar
func (*ScalarBls12377) Sub
func (s *ScalarBls12377) Sub(rhs Scalar) Scalar
func (*ScalarBls12377) UnmarshalBinary
func (s *ScalarBls12377) UnmarshalBinary(input []byte) error
func (*ScalarBls12377) UnmarshalJSON
func (s *ScalarBls12377) UnmarshalJSON(input []byte) error
func (*ScalarBls12377) UnmarshalText
func (s *ScalarBls12377) UnmarshalText(input []byte) error
func (*ScalarBls12377) Zero
func (s *ScalarBls12377) Zero() Scalar

type ScalarBls12377Gt

type ScalarBls12377Gt struct {
    // contains filtered or unexported fields
}
func (*ScalarBls12377Gt) Add
func (s *ScalarBls12377Gt) Add(rhs Scalar) Scalar
func (*ScalarBls12377Gt) BigInt
func (s *ScalarBls12377Gt) BigInt() *big.Int
func (*ScalarBls12377Gt) Bytes
func (s *ScalarBls12377Gt) Bytes() []byte
func (*ScalarBls12377Gt) Clone
func (s *ScalarBls12377Gt) Clone() Scalar
func (*ScalarBls12377Gt) Cmp
func (s *ScalarBls12377Gt) Cmp(rhs Scalar) int
func (*ScalarBls12377Gt) Cube
func (s *ScalarBls12377Gt) Cube() Scalar
func (*ScalarBls12377Gt) Div
func (s *ScalarBls12377Gt) Div(rhs Scalar) Scalar
func (*ScalarBls12377Gt) Double
func (s *ScalarBls12377Gt) Double() Scalar
func (*ScalarBls12377Gt) Hash
func (s *ScalarBls12377Gt) Hash(bytes []byte) Scalar
func (*ScalarBls12377Gt) Invert
func (s *ScalarBls12377Gt) Invert() (Scalar, error)
func (*ScalarBls12377Gt) IsEven
func (s *ScalarBls12377Gt) IsEven() bool
func (*ScalarBls12377Gt) IsOdd
func (s *ScalarBls12377Gt) IsOdd() bool
func (*ScalarBls12377Gt) IsOne
func (s *ScalarBls12377Gt) IsOne() bool
func (*ScalarBls12377Gt) IsZero
func (s *ScalarBls12377Gt) IsZero() bool
func (*ScalarBls12377Gt) MarshalBinary
func (s *ScalarBls12377Gt) MarshalBinary() ([]byte, error)
func (*ScalarBls12377Gt) MarshalJSON
func (s *ScalarBls12377Gt) MarshalJSON() ([]byte, error)
func (*ScalarBls12377Gt) MarshalText
func (s *ScalarBls12377Gt) MarshalText() ([]byte, error)
func (*ScalarBls12377Gt) Mul
func (s *ScalarBls12377Gt) Mul(rhs Scalar) Scalar
func (*ScalarBls12377Gt) MulAdd
func (s *ScalarBls12377Gt) MulAdd(y, z Scalar) Scalar
func (*ScalarBls12377Gt) Neg
func (s *ScalarBls12377Gt) Neg() Scalar
func (*ScalarBls12377Gt) New
func (s *ScalarBls12377Gt) New(input int) Scalar
func (*ScalarBls12377Gt) One
func (s *ScalarBls12377Gt) One() Scalar
func (*ScalarBls12377Gt) Point
func (s *ScalarBls12377Gt) Point() Point
func (*ScalarBls12377Gt) Random
func (s *ScalarBls12377Gt) Random(reader io.Reader) Scalar
func (*ScalarBls12377Gt) SetBigInt
func (s *ScalarBls12377Gt) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarBls12377Gt) SetBytes
func (s *ScalarBls12377Gt) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarBls12377Gt) SetBytesWide
func (s *ScalarBls12377Gt) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarBls12377Gt) Sqrt
func (s *ScalarBls12377Gt) Sqrt() (Scalar, error)
func (*ScalarBls12377Gt) Square
func (s *ScalarBls12377Gt) Square() Scalar
func (*ScalarBls12377Gt) Sub
func (s *ScalarBls12377Gt) Sub(rhs Scalar) Scalar
func (*ScalarBls12377Gt) UnmarshalBinary
func (s *ScalarBls12377Gt) UnmarshalBinary(input []byte) error
func (*ScalarBls12377Gt) UnmarshalJSON
func (s *ScalarBls12377Gt) UnmarshalJSON(input []byte) error
func (*ScalarBls12377Gt) UnmarshalText
func (s *ScalarBls12377Gt) UnmarshalText(input []byte) error
func (*ScalarBls12377Gt) Zero
func (s *ScalarBls12377Gt) Zero() Scalar

type ScalarBls12381

type ScalarBls12381 struct {
    // contains filtered or unexported fields
}
func (*ScalarBls12381) Add
func (s *ScalarBls12381) Add(rhs Scalar) Scalar
func (*ScalarBls12381) BigInt
func (s *ScalarBls12381) BigInt() *big.Int
func (*ScalarBls12381) Bytes
func (s *ScalarBls12381) Bytes() []byte
func (*ScalarBls12381) Clone
func (s *ScalarBls12381) Clone() Scalar
func (*ScalarBls12381) Cmp
func (s *ScalarBls12381) Cmp(rhs Scalar) int
func (*ScalarBls12381) Cube
func (s *ScalarBls12381) Cube() Scalar
func (*ScalarBls12381) Div
func (s *ScalarBls12381) Div(rhs Scalar) Scalar
func (*ScalarBls12381) Double
func (s *ScalarBls12381) Double() Scalar
func (*ScalarBls12381) Hash
func (s *ScalarBls12381) Hash(bytes []byte) Scalar
func (*ScalarBls12381) Invert
func (s *ScalarBls12381) Invert() (Scalar, error)
func (*ScalarBls12381) IsEven
func (s *ScalarBls12381) IsEven() bool
func (*ScalarBls12381) IsOdd
func (s *ScalarBls12381) IsOdd() bool
func (*ScalarBls12381) IsOne
func (s *ScalarBls12381) IsOne() bool
func (*ScalarBls12381) IsZero
func (s *ScalarBls12381) IsZero() bool
func (*ScalarBls12381) MarshalBinary
func (s *ScalarBls12381) MarshalBinary() ([]byte, error)
func (*ScalarBls12381) MarshalJSON
func (s *ScalarBls12381) MarshalJSON() ([]byte, error)
func (*ScalarBls12381) MarshalText
func (s *ScalarBls12381) MarshalText() ([]byte, error)
func (*ScalarBls12381) Mul
func (s *ScalarBls12381) Mul(rhs Scalar) Scalar
func (*ScalarBls12381) MulAdd
func (s *ScalarBls12381) MulAdd(y, z Scalar) Scalar
func (*ScalarBls12381) Neg
func (s *ScalarBls12381) Neg() Scalar
func (*ScalarBls12381) New
func (s *ScalarBls12381) New(value int) Scalar
func (*ScalarBls12381) One
func (s *ScalarBls12381) One() Scalar
func (*ScalarBls12381) Order
func (s *ScalarBls12381) Order() *big.Int
func (*ScalarBls12381) Point
func (s *ScalarBls12381) Point() Point
func (*ScalarBls12381) Random
func (s *ScalarBls12381) Random(reader io.Reader) Scalar
func (*ScalarBls12381) SetBigInt
func (s *ScalarBls12381) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarBls12381) SetBytes
func (s *ScalarBls12381) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarBls12381) SetBytesWide
func (s *ScalarBls12381) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarBls12381) SetPoint
func (s *ScalarBls12381) SetPoint(p Point) PairingScalar
func (*ScalarBls12381) Sqrt
func (s *ScalarBls12381) Sqrt() (Scalar, error)
func (*ScalarBls12381) Square
func (s *ScalarBls12381) Square() Scalar
func (*ScalarBls12381) Sub
func (s *ScalarBls12381) Sub(rhs Scalar) Scalar
func (*ScalarBls12381) UnmarshalBinary
func (s *ScalarBls12381) UnmarshalBinary(input []byte) error
func (*ScalarBls12381) UnmarshalJSON
func (s *ScalarBls12381) UnmarshalJSON(input []byte) error
func (*ScalarBls12381) UnmarshalText
func (s *ScalarBls12381) UnmarshalText(input []byte) error
func (*ScalarBls12381) Zero
func (s *ScalarBls12381) Zero() Scalar

type ScalarBls12381Gt

type ScalarBls12381Gt struct {
    // contains filtered or unexported fields
}
func (*ScalarBls12381Gt) Add
func (s *ScalarBls12381Gt) Add(rhs Scalar) Scalar
func (*ScalarBls12381Gt) BigInt
func (s *ScalarBls12381Gt) BigInt() *big.Int
func (*ScalarBls12381Gt) Bytes
func (s *ScalarBls12381Gt) Bytes() []byte
func (*ScalarBls12381Gt) Clone
func (s *ScalarBls12381Gt) Clone() Scalar
func (*ScalarBls12381Gt) Cmp
func (s *ScalarBls12381Gt) Cmp(rhs Scalar) int
func (*ScalarBls12381Gt) Cube
func (s *ScalarBls12381Gt) Cube() Scalar
func (*ScalarBls12381Gt) Div
func (s *ScalarBls12381Gt) Div(rhs Scalar) Scalar
func (*ScalarBls12381Gt) Double
func (s *ScalarBls12381Gt) Double() Scalar
func (*ScalarBls12381Gt) Hash
func (s *ScalarBls12381Gt) Hash(bytes []byte) Scalar
func (*ScalarBls12381Gt) Invert
func (s *ScalarBls12381Gt) Invert() (Scalar, error)
func (*ScalarBls12381Gt) IsEven
func (s *ScalarBls12381Gt) IsEven() bool
func (*ScalarBls12381Gt) IsOdd
func (s *ScalarBls12381Gt) IsOdd() bool
func (*ScalarBls12381Gt) IsOne
func (s *ScalarBls12381Gt) IsOne() bool
func (*ScalarBls12381Gt) IsZero
func (s *ScalarBls12381Gt) IsZero() bool
func (*ScalarBls12381Gt) MarshalBinary
func (s *ScalarBls12381Gt) MarshalBinary() ([]byte, error)
func (*ScalarBls12381Gt) MarshalJSON
func (s *ScalarBls12381Gt) MarshalJSON() ([]byte, error)
func (*ScalarBls12381Gt) MarshalText
func (s *ScalarBls12381Gt) MarshalText() ([]byte, error)
func (*ScalarBls12381Gt) Mul
func (s *ScalarBls12381Gt) Mul(rhs Scalar) Scalar
func (*ScalarBls12381Gt) MulAdd
func (s *ScalarBls12381Gt) MulAdd(y, z Scalar) Scalar
func (*ScalarBls12381Gt) Neg
func (s *ScalarBls12381Gt) Neg() Scalar
func (*ScalarBls12381Gt) New
func (s *ScalarBls12381Gt) New(input int) Scalar
func (*ScalarBls12381Gt) One
func (s *ScalarBls12381Gt) One() Scalar
func (*ScalarBls12381Gt) Point
func (s *ScalarBls12381Gt) Point() Point
func (*ScalarBls12381Gt) Random
func (s *ScalarBls12381Gt) Random(reader io.Reader) Scalar
func (*ScalarBls12381Gt) SetBigInt
func (s *ScalarBls12381Gt) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarBls12381Gt) SetBytes
func (s *ScalarBls12381Gt) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarBls12381Gt) SetBytesWide
func (s *ScalarBls12381Gt) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarBls12381Gt) Sqrt
func (s *ScalarBls12381Gt) Sqrt() (Scalar, error)
func (*ScalarBls12381Gt) Square
func (s *ScalarBls12381Gt) Square() Scalar
func (*ScalarBls12381Gt) Sub
func (s *ScalarBls12381Gt) Sub(rhs Scalar) Scalar
func (*ScalarBls12381Gt) UnmarshalBinary
func (s *ScalarBls12381Gt) UnmarshalBinary(input []byte) error
func (*ScalarBls12381Gt) UnmarshalJSON
func (s *ScalarBls12381Gt) UnmarshalJSON(input []byte) error
func (*ScalarBls12381Gt) UnmarshalText
func (s *ScalarBls12381Gt) UnmarshalText(input []byte) error
func (*ScalarBls12381Gt) Zero
func (s *ScalarBls12381Gt) Zero() Scalar

type ScalarEd25519

type ScalarEd25519 struct {
    // contains filtered or unexported fields
}
func (*ScalarEd25519) Add
func (s *ScalarEd25519) Add(rhs Scalar) Scalar
func (*ScalarEd25519) BigInt
func (s *ScalarEd25519) BigInt() *big.Int
func (*ScalarEd25519) Bytes
func (s *ScalarEd25519) Bytes() []byte
func (*ScalarEd25519) Clone
func (s *ScalarEd25519) Clone() Scalar
func (*ScalarEd25519) Cmp
func (s *ScalarEd25519) Cmp(rhs Scalar) int
func (*ScalarEd25519) Cube
func (s *ScalarEd25519) Cube() Scalar
func (*ScalarEd25519) Div
func (s *ScalarEd25519) Div(rhs Scalar) Scalar
func (*ScalarEd25519) Double
func (s *ScalarEd25519) Double() Scalar
func (*ScalarEd25519) GetEdwardsScalar
func (s *ScalarEd25519) GetEdwardsScalar() *edwards25519.Scalar
func (*ScalarEd25519) Hash
func (s *ScalarEd25519) Hash(bytes []byte) Scalar
func (*ScalarEd25519) Invert
func (s *ScalarEd25519) Invert() (Scalar, error)
func (*ScalarEd25519) IsEven
func (s *ScalarEd25519) IsEven() bool
func (*ScalarEd25519) IsOdd
func (s *ScalarEd25519) IsOdd() bool
func (*ScalarEd25519) IsOne
func (s *ScalarEd25519) IsOne() bool
func (*ScalarEd25519) IsZero
func (s *ScalarEd25519) IsZero() bool
func (*ScalarEd25519) MarshalBinary
func (s *ScalarEd25519) MarshalBinary() ([]byte, error)
func (*ScalarEd25519) MarshalJSON
func (s *ScalarEd25519) MarshalJSON() ([]byte, error)
func (*ScalarEd25519) MarshalText
func (s *ScalarEd25519) MarshalText() ([]byte, error)
func (*ScalarEd25519) Mul
func (s *ScalarEd25519) Mul(rhs Scalar) Scalar
func (*ScalarEd25519) MulAdd
func (s *ScalarEd25519) MulAdd(y, z Scalar) Scalar
func (*ScalarEd25519) Neg
func (s *ScalarEd25519) Neg() Scalar
func (*ScalarEd25519) New
func (s *ScalarEd25519) New(input int) Scalar
func (*ScalarEd25519) One
func (s *ScalarEd25519) One() Scalar
func (*ScalarEd25519) Point
func (s *ScalarEd25519) Point() Point
func (*ScalarEd25519) Random
func (s *ScalarEd25519) Random(reader io.Reader) Scalar
func (*ScalarEd25519) SetBigInt
func (s *ScalarEd25519) SetBigInt(x *big.Int) (Scalar, error)
func (*ScalarEd25519) SetBytes
func (s *ScalarEd25519) SetBytes(input []byte) (Scalar, error)

SetBytes takes input a 32-byte long array and returns a ed25519 scalar. The input must be 32-byte long and must be a reduced bytes.

func (*ScalarEd25519) SetBytesCanonical
func (s *ScalarEd25519) SetBytesCanonical(bytes []byte) (Scalar, error)

SetBytesCanonical uses SetCanonicalBytes of fillipo.io/edwards25519. https://github.com/FiloSottile/edwards25519/blob/v1.0.0-rc.1/scalar.go#L98 This function takes an input x and sets s = x, where x is a 32-byte little-endian encoding of s, then it returns the corresponding ed25519 scalar. If the input is not a canonical encoding of s, it returns nil and an error.

func (*ScalarEd25519) SetBytesClamping
func (s *ScalarEd25519) SetBytesClamping(bytes []byte) (Scalar, error)

SetBytesClamping uses SetBytesWithClamping of fillipo.io/edwards25519- https://github.com/FiloSottile/edwards25519/blob/v1.0.0-rc.1/scalar.go#L135 which applies the buffer pruning described in RFC 8032, Section 5.1.5 (also known as clamping) and sets bytes to the result. The input must be 32-byte long, and it is not modified. If bytes is not of the right length, SetBytesWithClamping returns nil and an error, and the receiver is unchanged.

func (*ScalarEd25519) SetBytesWide
func (s *ScalarEd25519) SetBytesWide(bytes []byte) (Scalar, error)

SetBytesWide takes input a 64-byte long byte array, reduce it and return an ed25519 scalar. It uses SetUniformBytes of fillipo.io/edwards25519 - https://github.com/FiloSottile/edwards25519/blob/v1.0.0-rc.1/scalar.go#L85 If bytes is not of the right length, it returns nil and an error

func (*ScalarEd25519) SetEdwardsScalar
func (s *ScalarEd25519) SetEdwardsScalar(sc *edwards25519.Scalar) *ScalarEd25519
func (*ScalarEd25519) Sqrt
func (s *ScalarEd25519) Sqrt() (Scalar, error)
func (*ScalarEd25519) Square
func (s *ScalarEd25519) Square() Scalar
func (*ScalarEd25519) Sub
func (s *ScalarEd25519) Sub(rhs Scalar) Scalar
func (*ScalarEd25519) UnmarshalBinary
func (s *ScalarEd25519) UnmarshalBinary(input []byte) error
func (*ScalarEd25519) UnmarshalJSON
func (s *ScalarEd25519) UnmarshalJSON(input []byte) error
func (*ScalarEd25519) UnmarshalText
func (s *ScalarEd25519) UnmarshalText(input []byte) error
func (*ScalarEd25519) Zero
func (s *ScalarEd25519) Zero() Scalar

type ScalarK256

type ScalarK256 struct {
    // contains filtered or unexported fields
}
func (*ScalarK256) Add
func (s *ScalarK256) Add(rhs Scalar) Scalar
func (*ScalarK256) BigInt
func (s *ScalarK256) BigInt() *big.Int
func (*ScalarK256) Bytes
func (s *ScalarK256) Bytes() []byte
func (*ScalarK256) Clone
func (s *ScalarK256) Clone() Scalar
func (*ScalarK256) Cmp
func (s *ScalarK256) Cmp(rhs Scalar) int
func (*ScalarK256) Cube
func (s *ScalarK256) Cube() Scalar
func (*ScalarK256) Div
func (s *ScalarK256) Div(rhs Scalar) Scalar
func (*ScalarK256) Double
func (s *ScalarK256) Double() Scalar
func (*ScalarK256) Hash
func (s *ScalarK256) Hash(bytes []byte) Scalar
func (*ScalarK256) Invert
func (s *ScalarK256) Invert() (Scalar, error)
func (*ScalarK256) IsEven
func (s *ScalarK256) IsEven() bool
func (*ScalarK256) IsOdd
func (s *ScalarK256) IsOdd() bool
func (*ScalarK256) IsOne
func (s *ScalarK256) IsOne() bool
func (*ScalarK256) IsZero
func (s *ScalarK256) IsZero() bool
func (*ScalarK256) MarshalBinary
func (s *ScalarK256) MarshalBinary() ([]byte, error)
func (*ScalarK256) MarshalJSON
func (s *ScalarK256) MarshalJSON() ([]byte, error)
func (*ScalarK256) MarshalText
func (s *ScalarK256) MarshalText() ([]byte, error)
func (*ScalarK256) Mul
func (s *ScalarK256) Mul(rhs Scalar) Scalar
func (*ScalarK256) MulAdd
func (s *ScalarK256) MulAdd(y, z Scalar) Scalar
func (*ScalarK256) Neg
func (s *ScalarK256) Neg() Scalar
func (*ScalarK256) New
func (s *ScalarK256) New(value int) Scalar
func (*ScalarK256) One
func (s *ScalarK256) One() Scalar
func (*ScalarK256) Point
func (s *ScalarK256) Point() Point
func (*ScalarK256) Random
func (s *ScalarK256) Random(reader io.Reader) Scalar
func (*ScalarK256) SetBigInt
func (s *ScalarK256) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarK256) SetBytes
func (s *ScalarK256) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarK256) SetBytesWide
func (s *ScalarK256) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarK256) Sqrt
func (s *ScalarK256) Sqrt() (Scalar, error)
func (*ScalarK256) Square
func (s *ScalarK256) Square() Scalar
func (*ScalarK256) Sub
func (s *ScalarK256) Sub(rhs Scalar) Scalar
func (*ScalarK256) UnmarshalBinary
func (s *ScalarK256) UnmarshalBinary(input []byte) error
func (*ScalarK256) UnmarshalJSON
func (s *ScalarK256) UnmarshalJSON(input []byte) error
func (*ScalarK256) UnmarshalText
func (s *ScalarK256) UnmarshalText(input []byte) error
func (*ScalarK256) Zero
func (s *ScalarK256) Zero() Scalar

type ScalarP256

type ScalarP256 struct {
    // contains filtered or unexported fields
}
func (*ScalarP256) Add
func (s *ScalarP256) Add(rhs Scalar) Scalar
func (*ScalarP256) BigInt
func (s *ScalarP256) BigInt() *big.Int
func (*ScalarP256) Bytes
func (s *ScalarP256) Bytes() []byte
func (*ScalarP256) Clone
func (s *ScalarP256) Clone() Scalar
func (*ScalarP256) Cmp
func (s *ScalarP256) Cmp(rhs Scalar) int
func (*ScalarP256) Cube
func (s *ScalarP256) Cube() Scalar
func (*ScalarP256) Div
func (s *ScalarP256) Div(rhs Scalar) Scalar
func (*ScalarP256) Double
func (s *ScalarP256) Double() Scalar
func (*ScalarP256) Hash
func (s *ScalarP256) Hash(bytes []byte) Scalar
func (*ScalarP256) Invert
func (s *ScalarP256) Invert() (Scalar, error)
func (*ScalarP256) IsEven
func (s *ScalarP256) IsEven() bool
func (*ScalarP256) IsOdd
func (s *ScalarP256) IsOdd() bool
func (*ScalarP256) IsOne
func (s *ScalarP256) IsOne() bool
func (*ScalarP256) IsZero
func (s *ScalarP256) IsZero() bool
func (*ScalarP256) MarshalBinary
func (s *ScalarP256) MarshalBinary() ([]byte, error)
func (*ScalarP256) MarshalJSON
func (s *ScalarP256) MarshalJSON() ([]byte, error)
func (*ScalarP256) MarshalText
func (s *ScalarP256) MarshalText() ([]byte, error)
func (*ScalarP256) Mul
func (s *ScalarP256) Mul(rhs Scalar) Scalar
func (*ScalarP256) MulAdd
func (s *ScalarP256) MulAdd(y, z Scalar) Scalar
func (*ScalarP256) Neg
func (s *ScalarP256) Neg() Scalar
func (*ScalarP256) New
func (s *ScalarP256) New(value int) Scalar
func (*ScalarP256) One
func (s *ScalarP256) One() Scalar
func (*ScalarP256) Point
func (s *ScalarP256) Point() Point
func (*ScalarP256) Random
func (s *ScalarP256) Random(reader io.Reader) Scalar
func (*ScalarP256) SetBigInt
func (s *ScalarP256) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarP256) SetBytes
func (s *ScalarP256) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarP256) SetBytesWide
func (s *ScalarP256) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarP256) Sqrt
func (s *ScalarP256) Sqrt() (Scalar, error)
func (*ScalarP256) Square
func (s *ScalarP256) Square() Scalar
func (*ScalarP256) Sub
func (s *ScalarP256) Sub(rhs Scalar) Scalar
func (*ScalarP256) UnmarshalBinary
func (s *ScalarP256) UnmarshalBinary(input []byte) error
func (*ScalarP256) UnmarshalJSON
func (s *ScalarP256) UnmarshalJSON(input []byte) error
func (*ScalarP256) UnmarshalText
func (s *ScalarP256) UnmarshalText(input []byte) error
func (*ScalarP256) Zero
func (s *ScalarP256) Zero() Scalar

type ScalarPallas

ScalarPallas - New interface

type ScalarPallas struct {
    // contains filtered or unexported fields
}
func (*ScalarPallas) Add
func (s *ScalarPallas) Add(rhs Scalar) Scalar
func (*ScalarPallas) BigInt
func (s *ScalarPallas) BigInt() *big.Int
func (*ScalarPallas) Bytes
func (s *ScalarPallas) Bytes() []byte
func (*ScalarPallas) Clone
func (s *ScalarPallas) Clone() Scalar
func (*ScalarPallas) Cmp
func (s *ScalarPallas) Cmp(rhs Scalar) int
func (*ScalarPallas) Cube
func (s *ScalarPallas) Cube() Scalar
func (*ScalarPallas) Div
func (s *ScalarPallas) Div(rhs Scalar) Scalar
func (*ScalarPallas) Double
func (s *ScalarPallas) Double() Scalar
func (*ScalarPallas) GetFq
func (s *ScalarPallas) GetFq() *fq.Fq
func (*ScalarPallas) Hash
func (s *ScalarPallas) Hash(bytes []byte) Scalar
func (*ScalarPallas) Invert
func (s *ScalarPallas) Invert() (Scalar, error)
func (*ScalarPallas) IsEven
func (s *ScalarPallas) IsEven() bool
func (*ScalarPallas) IsOdd
func (s *ScalarPallas) IsOdd() bool
func (*ScalarPallas) IsOne
func (s *ScalarPallas) IsOne() bool
func (*ScalarPallas) IsZero
func (s *ScalarPallas) IsZero() bool
func (*ScalarPallas) MarshalBinary
func (s *ScalarPallas) MarshalBinary() ([]byte, error)
func (*ScalarPallas) MarshalJSON
func (s *ScalarPallas) MarshalJSON() ([]byte, error)
func (*ScalarPallas) MarshalText
func (s *ScalarPallas) MarshalText() ([]byte, error)
func (*ScalarPallas) Mul
func (s *ScalarPallas) Mul(rhs Scalar) Scalar
func (*ScalarPallas) MulAdd
func (s *ScalarPallas) MulAdd(y, z Scalar) Scalar
func (*ScalarPallas) Neg
func (s *ScalarPallas) Neg() Scalar
func (*ScalarPallas) New
func (s *ScalarPallas) New(value int) Scalar
func (*ScalarPallas) One
func (s *ScalarPallas) One() Scalar
func (*ScalarPallas) Point
func (s *ScalarPallas) Point() Point
func (*ScalarPallas) Random
func (s *ScalarPallas) Random(reader io.Reader) Scalar
func (*ScalarPallas) SetBigInt
func (s *ScalarPallas) SetBigInt(v *big.Int) (Scalar, error)
func (*ScalarPallas) SetBytes
func (s *ScalarPallas) SetBytes(bytes []byte) (Scalar, error)
func (*ScalarPallas) SetBytesWide
func (s *ScalarPallas) SetBytesWide(bytes []byte) (Scalar, error)
func (*ScalarPallas) SetFq
func (s *ScalarPallas) SetFq(fq *fq.Fq) *ScalarPallas
func (*ScalarPallas) Sqrt
func (s *ScalarPallas) Sqrt() (Scalar, error)
func (*ScalarPallas) Square
func (s *ScalarPallas) Square() Scalar
func (*ScalarPallas) Sub
func (s *ScalarPallas) Sub(rhs Scalar) Scalar
func (*ScalarPallas) UnmarshalBinary
func (s *ScalarPallas) UnmarshalBinary(input []byte) error
func (*ScalarPallas) UnmarshalJSON
func (s *ScalarPallas) UnmarshalJSON(input []byte) error
func (*ScalarPallas) UnmarshalText
func (s *ScalarPallas) UnmarshalText(input []byte) error
func (*ScalarPallas) Zero
func (s *ScalarPallas) Zero() Scalar

Generated by gomarkdoc

Documentation

Overview

This implementation IS NOT constant time as it leverages math/big for big number operations.

Index

Constants

View Source
const (
	K256Name       = "secp256k1"
	BLS12381G1Name = "BLS12381G1"
	BLS12381G2Name = "BLS12381G2"
	BLS12831Name   = "BLS12831"
	P256Name       = "P-256"
	ED25519Name    = "ed25519"
	PallasName     = "pallas"
	BLS12377G1Name = "BLS12377G1"
	BLS12377G2Name = "BLS12377G2"
	BLS12377Name   = "BLS12377"
)

Variables

This section is empty.

Functions

func Ed25519Order

func Ed25519Order() *big.Int

SubgroupOrder returns the order of the Ed25519 base Point.

func VerifyEcdsa

func VerifyEcdsa(pk *EcPoint, hash []byte, sig *EcdsaSignature) bool

Verifies ECDSA signature using core types.

Types

type Bls12381Scalar

type Bls12381Scalar struct{}

func NewBls12381Scalar

func NewBls12381Scalar() *Bls12381Scalar

func (Bls12381Scalar) Add

func (k Bls12381Scalar) Add(x, y *big.Int) *big.Int

func (Bls12381Scalar) Bytes

func (k Bls12381Scalar) Bytes(x *big.Int) []byte

func (Bls12381Scalar) Div

func (k Bls12381Scalar) Div(x, y *big.Int) *big.Int

func (Bls12381Scalar) Hash

func (k Bls12381Scalar) Hash(input []byte) *big.Int

func (Bls12381Scalar) IsValid

func (k Bls12381Scalar) IsValid(x *big.Int) bool

func (Bls12381Scalar) Mul

func (k Bls12381Scalar) Mul(x, y *big.Int) *big.Int

func (Bls12381Scalar) Neg

func (k Bls12381Scalar) Neg(x *big.Int) *big.Int

func (Bls12381Scalar) Random

func (k Bls12381Scalar) Random() (*big.Int, error)

func (Bls12381Scalar) Sub

func (k Bls12381Scalar) Sub(x, y *big.Int) *big.Int

type Curve

type Curve struct {
	Scalar Scalar
	Point  Point
	Name   string
}

Curve represents a named elliptic curve with a scalar field and point group

func BLS12377G1

func BLS12377G1() *Curve

BLS12377G1 returns the BLS12-377 curve with points in G1

func BLS12377G2

func BLS12377G2() *Curve

BLS12377G2 returns the BLS12-377 curve with points in G2

func BLS12381G1

func BLS12381G1() *Curve

BLS12381G1 returns the BLS12-381 curve with points in G1

func BLS12381G2

func BLS12381G2() *Curve

BLS12381G2 returns the BLS12-381 curve with points in G2

func ED25519

func ED25519() *Curve

func GetCurveByName

func GetCurveByName(name string) *Curve

GetCurveByName returns the correct `Curve` given the name

func K256

func K256() *Curve

K256 returns the secp256k1 curve

func P256

func P256() *Curve

func PALLAS

func PALLAS() *Curve

func (Curve) NewGeneratorPoint

func (c Curve) NewGeneratorPoint() Point

func (Curve) NewIdentityPoint

func (c Curve) NewIdentityPoint() Point

func (Curve) NewScalar

func (c Curve) NewScalar() Scalar

func (Curve) ScalarBaseMult

func (c Curve) ScalarBaseMult(sc Scalar) Point

type EcPoint

type EcPoint struct {
	Curve elliptic.Curve
	X, Y  *big.Int
}

EcPoint represents an elliptic curve Point

func NewScalarBaseMult

func NewScalarBaseMult(curve elliptic.Curve, k *big.Int) (*EcPoint, error)

NewScalarBaseMult creates a Point from the base Point multiplied by a field element

func PointFromBytesUncompressed

func PointFromBytesUncompressed(curve elliptic.Curve, b []byte) (*EcPoint, error)

PointFromBytesUncompressed outputs uncompressed X || Y similar to https://www.secg.org/sec1-v1.99.dif.pdf section 2.2 and 2.3

func (*EcPoint) Add

func (a *EcPoint) Add(b *EcPoint) (*EcPoint, error)

Add performs elliptic curve addition on two points

func (EcPoint) Bytes

func (a EcPoint) Bytes() []byte

Bytes returns the bytes represented by this Point with x || y

func (EcPoint) Equals

func (a EcPoint) Equals(b *EcPoint) bool

Equals return true if a + b have the same x,y coordinates

func (EcPoint) IsBasePoint

func (a EcPoint) IsBasePoint() bool

IsBasePoint returns true if this Point is curve's base Point

func (EcPoint) IsIdentity

func (a EcPoint) IsIdentity() bool

IsIdentity returns true if this Point is the Point at infinity

func (EcPoint) IsOnCurve

func (a EcPoint) IsOnCurve() bool

func (EcPoint) IsValid

func (a EcPoint) IsValid() bool

func (*EcPoint) MarshalBinary

func (a *EcPoint) MarshalBinary() ([]byte, error)

func (EcPoint) MarshalJSON

func (a EcPoint) MarshalJSON() ([]byte, error)

MarshalJSON serializes

func (*EcPoint) Neg

func (a *EcPoint) Neg() (*EcPoint, error)

Neg returns the negation of a Weierstrass Point.

func (*EcPoint) ScalarMult

func (a *EcPoint) ScalarMult(k *big.Int) (*EcPoint, error)

ScalarMult multiplies this Point by a Scalar

func (*EcPoint) UnmarshalBinary

func (a *EcPoint) UnmarshalBinary(data []byte) error

func (*EcPoint) UnmarshalJSON

func (a *EcPoint) UnmarshalJSON(bytes []byte) error

type EcPointJson

type EcPointJson struct {
	CurveName string
	X, Y      *big.Int
}

EcPointJson encapsulates the data that is serialized to JSON used internally and not for external use. Public so other pieces can use for serialization

type EcScalar

type EcScalar interface {
	Add(x, y *big.Int) *big.Int
	Sub(x, y *big.Int) *big.Int
	Neg(x *big.Int) *big.Int
	Mul(x, y *big.Int) *big.Int
	Hash(input []byte) *big.Int
	Div(x, y *big.Int) *big.Int
	Random() (*big.Int, error)
	IsValid(x *big.Int) bool
	Bytes(x *big.Int) []byte // fixed-length byte array
}

type EcdsaSignature

type EcdsaSignature struct {
	V    int
	R, S *big.Int
}

EcdsaSignature represents a (composite) digital signature

type EcdsaVerify

type EcdsaVerify func(pubKey *EcPoint, hash []byte, signature *EcdsaSignature) bool

EcdsaVerify runs a curve- or algorithm-specific ECDSA verification function on input an ECDSA public (verification) key, a message digest, and an ECDSA signature. It must return true if all the parameters are sane and the ECDSA signature is valid, and false otherwise

type Ed25519Scalar

type Ed25519Scalar struct{}

func NewEd25519Scalar

func NewEd25519Scalar() *Ed25519Scalar

func (Ed25519Scalar) Add

func (k Ed25519Scalar) Add(x, y *big.Int) *big.Int

func (Ed25519Scalar) Bytes

func (k Ed25519Scalar) Bytes(x *big.Int) []byte

func (Ed25519Scalar) Div

func (k Ed25519Scalar) Div(x, y *big.Int) *big.Int

func (Ed25519Scalar) Hash

func (k Ed25519Scalar) Hash(input []byte) *big.Int

func (Ed25519Scalar) IsValid

func (k Ed25519Scalar) IsValid(x *big.Int) bool

func (Ed25519Scalar) Mul

func (k Ed25519Scalar) Mul(x, y *big.Int) *big.Int

func (Ed25519Scalar) Neg

func (k Ed25519Scalar) Neg(x *big.Int) *big.Int

func (Ed25519Scalar) Random

func (k Ed25519Scalar) Random() (*big.Int, error)

func (Ed25519Scalar) RandomWithReader

func (k Ed25519Scalar) RandomWithReader(r io.Reader) (*big.Int, error)

func (Ed25519Scalar) Sub

func (k Ed25519Scalar) Sub(x, y *big.Int) *big.Int

type Element

type Element struct {
	Modulus *Field   `json:"modulus"`
	Value   *big.Int `json:"value"`
}

Element is a group element within a finite field.

func (Element) Add

func (x Element) Add(y *Element) *Element

Add returns the sum x+y

func (Element) BigInt

func (x Element) BigInt() *big.Int

BigInt returns value as a big.Int

func (Element) Bytes

func (x Element) Bytes() []byte

Bytes returns the value as bytes

func (Element) Clone

func (x Element) Clone() *Element

Clone returns a new copy of the element

func (Element) Div

func (x Element) Div(y *Element) *Element

Div returns the quotient x/y

func (Element) Field

func (x Element) Field() *Field

func (Element) Invert

func (x Element) Invert() *Element

func (Element) IsEqual

func (x Element) IsEqual(y *Element) bool

IsEqual returns x == y

func (*Element) MarshalJSON

func (x *Element) MarshalJSON() ([]byte, error)

Marshal Element to JSON

func (Element) Mul

func (x Element) Mul(y *Element) *Element

Mul returns the product x*y

func (Element) Neg

func (x Element) Neg() *Element

Neg returns the field negation

func (Element) Pow

func (x Element) Pow(y *Element) *Element

Pow computes x^y reduced by the modulus

func (Element) Sqrt

func (x Element) Sqrt() *Element

func (Element) Sub

func (x Element) Sub(y *Element) *Element

Sub returns the difference x-y

func (*Element) UnmarshalJSON

func (x *Element) UnmarshalJSON(bytes []byte) error

type ElementJSON

type ElementJSON struct {
	Modulus string `json:"modulus"`
	Value   string `json:"value"`
}

ElementJSON is used in JSON<>Element conversions. For years, big.Int hasn't properly supported JSON unmarshaling https://github.com/golang/go/issues/28154

type Ep

type Ep struct {
	// contains filtered or unexported fields
}

func (*Ep) Add

func (p *Ep) Add(lhs *Ep, rhs *Ep) *Ep

func (*Ep) CMove

func (p *Ep) CMove(lhs, rhs *Ep, condition int) *Ep

func (Ep) CurveName

func (p Ep) CurveName() string

func (*Ep) Double

func (p *Ep) Double(other *Ep) *Ep

func (*Ep) Equal

func (p *Ep) Equal(other *Ep) bool

func (*Ep) FromAffineCompressed

func (p *Ep) FromAffineCompressed(bytes []byte) (*Ep, error)

func (*Ep) FromAffineUncompressed

func (p *Ep) FromAffineUncompressed(bytes []byte) (*Ep, error)

func (*Ep) Generator

func (p *Ep) Generator() *Ep

func (*Ep) Hash

func (p *Ep) Hash(bytes []byte) *Ep

func (*Ep) Identity

func (p *Ep) Identity() *Ep

func (*Ep) IsIdentity

func (p *Ep) IsIdentity() bool

func (*Ep) IsOnCurve

func (p *Ep) IsOnCurve() bool

func (*Ep) Mul

func (p *Ep) Mul(point *Ep, scalar *fq.Fq) *Ep

func (*Ep) Neg

func (p *Ep) Neg(other *Ep) *Ep

func (*Ep) Random

func (p *Ep) Random(reader io.Reader) *Ep

func (*Ep) Set

func (p *Ep) Set(other *Ep) *Ep

func (*Ep) Sub

func (p *Ep) Sub(lhs, rhs *Ep) *Ep

func (Ep) SumOfProducts

func (p Ep) SumOfProducts(points []*Ep, scalars []Scalar) *Ep

func (*Ep) ToAffineCompressed

func (p *Ep) ToAffineCompressed() []byte

func (*Ep) ToAffineUncompressed

func (p *Ep) ToAffineUncompressed() []byte

func (*Ep) X

func (p *Ep) X() *fp.Fp

func (*Ep) Y

func (p *Ep) Y() *fp.Fp

type Field

type Field struct {
	*big.Int
}

Field is a finite field.

func NewField

func NewField(modulus *big.Int) *Field

New is a constructor for a Field.

func (Field) ElementFromBytes

func (f Field) ElementFromBytes(bytes []byte) *Element

ElementFromBytes initializes a new field element from big-endian bytes

func (Field) IsValid

func (f Field) IsValid(value *big.Int) bool

IsValid returns whether or not the value is within [0, modulus)

func (Field) NewElement

func (f Field) NewElement(value *big.Int) *Element

func (Field) One

func (f Field) One() *Element

func (Field) RandomElement

func (f Field) RandomElement(r io.Reader) (*Element, error)

func (Field) ReducedElementFromBytes

func (f Field) ReducedElementFromBytes(bytes []byte) *Element

ReducedElementFromBytes initializes a new field element from big-endian bytes and reduces it by the modulus of the field.

WARNING: If this is used with cryptographic constructions which rely on a uniform distribution of values, this may introduce a bias to the value of the returned field element. This happens when the integer range of the provided bytes is not an integer multiple of the field order.

Assume we are working in field which a modulus of 3 and the range of the uniform random bytes we provide as input is 5. Thus, the set of field elements is {0, 1, 2} and the set of integer values for the input bytes is: {0, 1, 2, 3, 4}. What is the distribution of the output values produced by this function?

ReducedElementFromBytes(0) => 0
ReducedElementFromBytes(1) => 1
ReducedElementFromBytes(2) => 2
ReducedElementFromBytes(3) => 0
ReducedElementFromBytes(4) => 1

For a value space V and random value v, a uniform distribution is defined as P[V = v] = 1/|V| where |V| is to the order of the field. Using the results from above, we see that P[v = 0] = 2/5, P[v = 1] = 2/5, and P[v = 2] = 1/5. For a uniform distribution we would expect these to each be equal to 1/3. As they do not, this does not return uniform output for that example.

To see why this is okay if the range is a multiple of the field order, change the input range to 6 and notice that now each output has a probability of 2/6 = 1/3, and the output is uniform.

func (Field) Zero

func (f Field) Zero() *Element

type K256Scalar

type K256Scalar struct{}

func NewK256Scalar

func NewK256Scalar() *K256Scalar

func (K256Scalar) Add

func (k K256Scalar) Add(x, y *big.Int) *big.Int

func (K256Scalar) Bytes

func (k K256Scalar) Bytes(x *big.Int) []byte

func (K256Scalar) Div

func (k K256Scalar) Div(x, y *big.Int) *big.Int

func (K256Scalar) Hash

func (k K256Scalar) Hash(input []byte) *big.Int

func (K256Scalar) IsValid

func (k K256Scalar) IsValid(x *big.Int) bool

func (K256Scalar) Mul

func (k K256Scalar) Mul(x, y *big.Int) *big.Int

func (K256Scalar) Neg

func (k K256Scalar) Neg(x *big.Int) *big.Int

func (K256Scalar) Random

func (k K256Scalar) Random() (*big.Int, error)

func (K256Scalar) Sub

func (k K256Scalar) Sub(x, y *big.Int) *big.Int

type P256Scalar

type P256Scalar struct{}

func NewP256Scalar

func NewP256Scalar() *P256Scalar

func (P256Scalar) Add

func (k P256Scalar) Add(x, y *big.Int) *big.Int

func (P256Scalar) Bytes

func (k P256Scalar) Bytes(x *big.Int) []byte

func (P256Scalar) Div

func (k P256Scalar) Div(x, y *big.Int) *big.Int

func (P256Scalar) Hash

func (k P256Scalar) Hash(input []byte) *big.Int

func (P256Scalar) IsValid

func (k P256Scalar) IsValid(x *big.Int) bool

func (P256Scalar) Mul

func (k P256Scalar) Mul(x, y *big.Int) *big.Int

func (P256Scalar) Neg

func (k P256Scalar) Neg(x *big.Int) *big.Int

func (P256Scalar) Random

func (k P256Scalar) Random() (*big.Int, error)

func (P256Scalar) Sub

func (k P256Scalar) Sub(x, y *big.Int) *big.Int

type PairingCurve

type PairingCurve struct {
	Scalar  PairingScalar
	PointG1 PairingPoint
	PointG2 PairingPoint
	GT      Scalar
	Name    string
}

PairingCurve represents a named elliptic curve that supports pairings

func BLS12381

func BLS12381(preferredPoint Point) *PairingCurve

func GetPairingCurveByName

func GetPairingCurveByName(name string) *PairingCurve

func (PairingCurve) NewG1GeneratorPoint

func (c PairingCurve) NewG1GeneratorPoint() PairingPoint

func (PairingCurve) NewG1IdentityPoint

func (c PairingCurve) NewG1IdentityPoint() PairingPoint

func (PairingCurve) NewG2GeneratorPoint

func (c PairingCurve) NewG2GeneratorPoint() PairingPoint

func (PairingCurve) NewG2IdentityPoint

func (c PairingCurve) NewG2IdentityPoint() PairingPoint

func (PairingCurve) NewScalar

func (c PairingCurve) NewScalar() PairingScalar

func (PairingCurve) ScalarG1BaseMult

func (c PairingCurve) ScalarG1BaseMult(sc Scalar) PairingPoint

func (PairingCurve) ScalarG2BaseMult

func (c PairingCurve) ScalarG2BaseMult(sc Scalar) PairingPoint

type PairingPoint

type PairingPoint interface {
	Point
	OtherGroup() PairingPoint
	Pairing(rhs PairingPoint) Scalar
	MultiPairing(...PairingPoint) Scalar
}

type PairingScalar

type PairingScalar interface {
	Scalar
	SetPoint(p Point) PairingScalar
}

type PallasCurve

type PallasCurve struct {
	*elliptic.CurveParams
}

func Pallas

func Pallas() *PallasCurve

func (*PallasCurve) Add

func (curve *PallasCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)

func (*PallasCurve) Double

func (curve *PallasCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)

func (*PallasCurve) IsOnCurve

func (curve *PallasCurve) IsOnCurve(x, y *big.Int) bool

func (*PallasCurve) Params

func (curve *PallasCurve) Params() *elliptic.CurveParams

func (*PallasCurve) ScalarBaseMult

func (curve *PallasCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)

func (*PallasCurve) ScalarMult

func (curve *PallasCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)

type PallasScalar

type PallasScalar struct{}

PallasScalar - Old interface

func NewPallasScalar

func NewPallasScalar() *PallasScalar

func (PallasScalar) Add

func (k PallasScalar) Add(x, y *big.Int) *big.Int

func (PallasScalar) Bytes

func (k PallasScalar) Bytes(x *big.Int) []byte

func (PallasScalar) Div

func (k PallasScalar) Div(x, y *big.Int) *big.Int

func (PallasScalar) Hash

func (k PallasScalar) Hash(input []byte) *big.Int

func (PallasScalar) IsValid

func (k PallasScalar) IsValid(x *big.Int) bool

func (PallasScalar) Mul

func (k PallasScalar) Mul(x, y *big.Int) *big.Int

func (PallasScalar) Neg

func (k PallasScalar) Neg(x *big.Int) *big.Int

func (PallasScalar) Random

func (k PallasScalar) Random() (*big.Int, error)

func (PallasScalar) Sub

func (k PallasScalar) Sub(x, y *big.Int) *big.Int

type Point

type Point interface {
	Random(reader io.Reader) Point
	Hash(bytes []byte) Point
	Identity() Point
	Generator() Point
	IsIdentity() bool
	IsNegative() bool
	IsOnCurve() bool
	Double() Point
	Scalar() Scalar
	Neg() Point
	Add(rhs Point) Point
	Sub(rhs Point) Point
	Mul(rhs Scalar) Point
	Equal(rhs Point) bool
	Set(x, y *big.Int) (Point, error)
	ToAffineCompressed() []byte
	ToAffineUncompressed() []byte
	FromAffineCompressed(bytes []byte) (Point, error)
	FromAffineUncompressed(bytes []byte) (Point, error)
	CurveName() string
	SumOfProducts(points []Point, scalars []Scalar) Point
}

Point represents an elliptic curve point

type PointBls12377G1

type PointBls12377G1 struct {
	// contains filtered or unexported fields
}

func (*PointBls12377G1) Add

func (p *PointBls12377G1) Add(rhs Point) Point

func (*PointBls12377G1) CurveName

func (p *PointBls12377G1) CurveName() string

func (*PointBls12377G1) Double

func (p *PointBls12377G1) Double() Point

func (*PointBls12377G1) Equal

func (p *PointBls12377G1) Equal(rhs Point) bool

func (*PointBls12377G1) FromAffineCompressed

func (p *PointBls12377G1) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointBls12377G1) FromAffineUncompressed

func (p *PointBls12377G1) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointBls12377G1) Generator

func (p *PointBls12377G1) Generator() Point

func (*PointBls12377G1) Hash

func (p *PointBls12377G1) Hash(bytes []byte) Point

func (*PointBls12377G1) Identity

func (p *PointBls12377G1) Identity() Point

func (*PointBls12377G1) IsIdentity

func (p *PointBls12377G1) IsIdentity() bool

func (*PointBls12377G1) IsNegative

func (p *PointBls12377G1) IsNegative() bool

func (*PointBls12377G1) IsOnCurve

func (p *PointBls12377G1) IsOnCurve() bool

func (*PointBls12377G1) MarshalBinary

func (p *PointBls12377G1) MarshalBinary() ([]byte, error)

func (*PointBls12377G1) MarshalJSON

func (p *PointBls12377G1) MarshalJSON() ([]byte, error)

func (*PointBls12377G1) MarshalText

func (p *PointBls12377G1) MarshalText() ([]byte, error)

func (*PointBls12377G1) Modulus

func (p *PointBls12377G1) Modulus() *big.Int

func (*PointBls12377G1) Mul

func (p *PointBls12377G1) Mul(rhs Scalar) Point

func (*PointBls12377G1) MultiPairing

func (p *PointBls12377G1) MultiPairing(points ...PairingPoint) Scalar

func (*PointBls12377G1) Neg

func (p *PointBls12377G1) Neg() Point

func (*PointBls12377G1) OtherGroup

func (p *PointBls12377G1) OtherGroup() PairingPoint

func (*PointBls12377G1) Pairing

func (p *PointBls12377G1) Pairing(rhs PairingPoint) Scalar

func (*PointBls12377G1) Random

func (p *PointBls12377G1) Random(reader io.Reader) Point

func (*PointBls12377G1) Scalar

func (p *PointBls12377G1) Scalar() Scalar

func (*PointBls12377G1) Set

func (p *PointBls12377G1) Set(x, y *big.Int) (Point, error)

func (*PointBls12377G1) Sub

func (p *PointBls12377G1) Sub(rhs Point) Point

func (*PointBls12377G1) SumOfProducts

func (p *PointBls12377G1) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointBls12377G1) ToAffineCompressed

func (p *PointBls12377G1) ToAffineCompressed() []byte

func (*PointBls12377G1) ToAffineUncompressed

func (p *PointBls12377G1) ToAffineUncompressed() []byte

func (*PointBls12377G1) UnmarshalBinary

func (p *PointBls12377G1) UnmarshalBinary(input []byte) error

func (*PointBls12377G1) UnmarshalJSON

func (p *PointBls12377G1) UnmarshalJSON(input []byte) error

func (*PointBls12377G1) UnmarshalText

func (p *PointBls12377G1) UnmarshalText(input []byte) error

func (*PointBls12377G1) X

func (p *PointBls12377G1) X() *big.Int

func (*PointBls12377G1) Y

func (p *PointBls12377G1) Y() *big.Int

type PointBls12377G2

type PointBls12377G2 struct {
	// contains filtered or unexported fields
}

func (*PointBls12377G2) Add

func (p *PointBls12377G2) Add(rhs Point) Point

func (*PointBls12377G2) CurveName

func (p *PointBls12377G2) CurveName() string

func (*PointBls12377G2) Double

func (p *PointBls12377G2) Double() Point

func (*PointBls12377G2) Equal

func (p *PointBls12377G2) Equal(rhs Point) bool

func (*PointBls12377G2) FromAffineCompressed

func (p *PointBls12377G2) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointBls12377G2) FromAffineUncompressed

func (p *PointBls12377G2) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointBls12377G2) Generator

func (p *PointBls12377G2) Generator() Point

func (*PointBls12377G2) Hash

func (p *PointBls12377G2) Hash(bytes []byte) Point

func (*PointBls12377G2) Identity

func (p *PointBls12377G2) Identity() Point

func (*PointBls12377G2) IsIdentity

func (p *PointBls12377G2) IsIdentity() bool

func (*PointBls12377G2) IsNegative

func (p *PointBls12377G2) IsNegative() bool

func (*PointBls12377G2) IsOnCurve

func (p *PointBls12377G2) IsOnCurve() bool

func (*PointBls12377G2) MarshalBinary

func (p *PointBls12377G2) MarshalBinary() ([]byte, error)

func (*PointBls12377G2) MarshalJSON

func (p *PointBls12377G2) MarshalJSON() ([]byte, error)

func (*PointBls12377G2) MarshalText

func (p *PointBls12377G2) MarshalText() ([]byte, error)

func (*PointBls12377G2) Modulus

func (p *PointBls12377G2) Modulus() *big.Int

func (*PointBls12377G2) Mul

func (p *PointBls12377G2) Mul(rhs Scalar) Point

func (*PointBls12377G2) MultiPairing

func (p *PointBls12377G2) MultiPairing(points ...PairingPoint) Scalar

func (*PointBls12377G2) Neg

func (p *PointBls12377G2) Neg() Point

func (*PointBls12377G2) OtherGroup

func (p *PointBls12377G2) OtherGroup() PairingPoint

func (*PointBls12377G2) Pairing

func (p *PointBls12377G2) Pairing(rhs PairingPoint) Scalar

func (*PointBls12377G2) Random

func (p *PointBls12377G2) Random(reader io.Reader) Point

func (*PointBls12377G2) Scalar

func (p *PointBls12377G2) Scalar() Scalar

func (*PointBls12377G2) Set

func (p *PointBls12377G2) Set(x, y *big.Int) (Point, error)

func (*PointBls12377G2) Sub

func (p *PointBls12377G2) Sub(rhs Point) Point

func (*PointBls12377G2) SumOfProducts

func (p *PointBls12377G2) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointBls12377G2) ToAffineCompressed

func (p *PointBls12377G2) ToAffineCompressed() []byte

func (*PointBls12377G2) ToAffineUncompressed

func (p *PointBls12377G2) ToAffineUncompressed() []byte

func (*PointBls12377G2) UnmarshalBinary

func (p *PointBls12377G2) UnmarshalBinary(input []byte) error

func (*PointBls12377G2) UnmarshalJSON

func (p *PointBls12377G2) UnmarshalJSON(input []byte) error

func (*PointBls12377G2) UnmarshalText

func (p *PointBls12377G2) UnmarshalText(input []byte) error

func (*PointBls12377G2) X

func (p *PointBls12377G2) X() *big.Int

func (*PointBls12377G2) Y

func (p *PointBls12377G2) Y() *big.Int

type PointBls12381G1

type PointBls12381G1 struct {
	Value *bls12381.PointG1
}

func (*PointBls12381G1) Add

func (p *PointBls12381G1) Add(rhs Point) Point

func (*PointBls12381G1) CurveName

func (p *PointBls12381G1) CurveName() string

func (*PointBls12381G1) Double

func (p *PointBls12381G1) Double() Point

func (*PointBls12381G1) Equal

func (p *PointBls12381G1) Equal(rhs Point) bool

func (*PointBls12381G1) FromAffineCompressed

func (p *PointBls12381G1) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointBls12381G1) FromAffineUncompressed

func (p *PointBls12381G1) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointBls12381G1) Generator

func (p *PointBls12381G1) Generator() Point

func (*PointBls12381G1) Hash

func (p *PointBls12381G1) Hash(bytes []byte) Point

func (*PointBls12381G1) Identity

func (p *PointBls12381G1) Identity() Point

func (*PointBls12381G1) IsIdentity

func (p *PointBls12381G1) IsIdentity() bool

func (*PointBls12381G1) IsNegative

func (p *PointBls12381G1) IsNegative() bool

func (*PointBls12381G1) IsOnCurve

func (p *PointBls12381G1) IsOnCurve() bool

func (*PointBls12381G1) MarshalBinary

func (p *PointBls12381G1) MarshalBinary() ([]byte, error)

func (*PointBls12381G1) MarshalJSON

func (p *PointBls12381G1) MarshalJSON() ([]byte, error)

func (*PointBls12381G1) MarshalText

func (p *PointBls12381G1) MarshalText() ([]byte, error)

func (*PointBls12381G1) Modulus

func (p *PointBls12381G1) Modulus() *big.Int

func (*PointBls12381G1) Mul

func (p *PointBls12381G1) Mul(rhs Scalar) Point

func (*PointBls12381G1) MultiPairing

func (p *PointBls12381G1) MultiPairing(points ...PairingPoint) Scalar

func (*PointBls12381G1) Neg

func (p *PointBls12381G1) Neg() Point

func (*PointBls12381G1) OtherGroup

func (p *PointBls12381G1) OtherGroup() PairingPoint

func (*PointBls12381G1) Pairing

func (p *PointBls12381G1) Pairing(rhs PairingPoint) Scalar

func (*PointBls12381G1) Random

func (p *PointBls12381G1) Random(reader io.Reader) Point

func (*PointBls12381G1) Scalar

func (p *PointBls12381G1) Scalar() Scalar

func (*PointBls12381G1) Set

func (p *PointBls12381G1) Set(x, y *big.Int) (Point, error)

func (*PointBls12381G1) Sub

func (p *PointBls12381G1) Sub(rhs Point) Point

func (*PointBls12381G1) SumOfProducts

func (p *PointBls12381G1) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointBls12381G1) ToAffineCompressed

func (p *PointBls12381G1) ToAffineCompressed() []byte

func (*PointBls12381G1) ToAffineUncompressed

func (p *PointBls12381G1) ToAffineUncompressed() []byte

func (*PointBls12381G1) UnmarshalBinary

func (p *PointBls12381G1) UnmarshalBinary(input []byte) error

func (*PointBls12381G1) UnmarshalJSON

func (p *PointBls12381G1) UnmarshalJSON(input []byte) error

func (*PointBls12381G1) UnmarshalText

func (p *PointBls12381G1) UnmarshalText(input []byte) error

func (*PointBls12381G1) X

func (p *PointBls12381G1) X() *big.Int

func (*PointBls12381G1) Y

func (p *PointBls12381G1) Y() *big.Int

type PointBls12381G2

type PointBls12381G2 struct {
	Value *bls12381.PointG2
}

func (*PointBls12381G2) Add

func (p *PointBls12381G2) Add(rhs Point) Point

func (*PointBls12381G2) CurveName

func (p *PointBls12381G2) CurveName() string

func (*PointBls12381G2) Double

func (p *PointBls12381G2) Double() Point

func (*PointBls12381G2) Equal

func (p *PointBls12381G2) Equal(rhs Point) bool

func (*PointBls12381G2) FromAffineCompressed

func (p *PointBls12381G2) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointBls12381G2) FromAffineUncompressed

func (p *PointBls12381G2) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointBls12381G2) Generator

func (p *PointBls12381G2) Generator() Point

func (*PointBls12381G2) Hash

func (p *PointBls12381G2) Hash(bytes []byte) Point

func (*PointBls12381G2) Identity

func (p *PointBls12381G2) Identity() Point

func (*PointBls12381G2) IsIdentity

func (p *PointBls12381G2) IsIdentity() bool

func (*PointBls12381G2) IsNegative

func (p *PointBls12381G2) IsNegative() bool

func (*PointBls12381G2) IsOnCurve

func (p *PointBls12381G2) IsOnCurve() bool

func (*PointBls12381G2) MarshalBinary

func (p *PointBls12381G2) MarshalBinary() ([]byte, error)

func (*PointBls12381G2) MarshalJSON

func (p *PointBls12381G2) MarshalJSON() ([]byte, error)

func (*PointBls12381G2) MarshalText

func (p *PointBls12381G2) MarshalText() ([]byte, error)

func (*PointBls12381G2) Modulus

func (p *PointBls12381G2) Modulus() *big.Int

func (*PointBls12381G2) Mul

func (p *PointBls12381G2) Mul(rhs Scalar) Point

func (*PointBls12381G2) MultiPairing

func (p *PointBls12381G2) MultiPairing(points ...PairingPoint) Scalar

func (*PointBls12381G2) Neg

func (p *PointBls12381G2) Neg() Point

func (*PointBls12381G2) OtherGroup

func (p *PointBls12381G2) OtherGroup() PairingPoint

func (*PointBls12381G2) Pairing

func (p *PointBls12381G2) Pairing(rhs PairingPoint) Scalar

func (*PointBls12381G2) Random

func (p *PointBls12381G2) Random(reader io.Reader) Point

func (*PointBls12381G2) Scalar

func (p *PointBls12381G2) Scalar() Scalar

func (*PointBls12381G2) Set

func (p *PointBls12381G2) Set(x, y *big.Int) (Point, error)

func (*PointBls12381G2) Sub

func (p *PointBls12381G2) Sub(rhs Point) Point

func (*PointBls12381G2) SumOfProducts

func (p *PointBls12381G2) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointBls12381G2) ToAffineCompressed

func (p *PointBls12381G2) ToAffineCompressed() []byte

func (*PointBls12381G2) ToAffineUncompressed

func (p *PointBls12381G2) ToAffineUncompressed() []byte

func (*PointBls12381G2) UnmarshalBinary

func (p *PointBls12381G2) UnmarshalBinary(input []byte) error

func (*PointBls12381G2) UnmarshalJSON

func (p *PointBls12381G2) UnmarshalJSON(input []byte) error

func (*PointBls12381G2) UnmarshalText

func (p *PointBls12381G2) UnmarshalText(input []byte) error

func (*PointBls12381G2) X

func (p *PointBls12381G2) X() *big.Int

func (*PointBls12381G2) Y

func (p *PointBls12381G2) Y() *big.Int

type PointEd25519

type PointEd25519 struct {
	// contains filtered or unexported fields
}

func (*PointEd25519) Add

func (p *PointEd25519) Add(rhs Point) Point

func (*PointEd25519) CurveName

func (p *PointEd25519) CurveName() string

func (*PointEd25519) Double

func (p *PointEd25519) Double() Point

func (*PointEd25519) Equal

func (p *PointEd25519) Equal(rhs Point) bool

func (*PointEd25519) FromAffineCompressed

func (p *PointEd25519) FromAffineCompressed(inBytes []byte) (Point, error)

func (*PointEd25519) FromAffineUncompressed

func (p *PointEd25519) FromAffineUncompressed(inBytes []byte) (Point, error)

func (*PointEd25519) Generator

func (p *PointEd25519) Generator() Point

func (*PointEd25519) GetEdwardsPoint

func (p *PointEd25519) GetEdwardsPoint() *edwards25519.Point

func (*PointEd25519) Hash

func (p *PointEd25519) Hash(bytes []byte) Point

func (*PointEd25519) Identity

func (p *PointEd25519) Identity() Point

func (*PointEd25519) IsIdentity

func (p *PointEd25519) IsIdentity() bool

func (*PointEd25519) IsNegative

func (p *PointEd25519) IsNegative() bool

func (*PointEd25519) IsOnCurve

func (p *PointEd25519) IsOnCurve() bool

func (*PointEd25519) MangleScalarBitsAndMulByBasepointToProducePublicKey

func (p *PointEd25519) MangleScalarBitsAndMulByBasepointToProducePublicKey(rhs *ScalarEd25519) *PointEd25519

MangleScalarBitsAndMulByBasepointToProducePublicKey is a function for mangling the bits of a (formerly mathematically well-defined) "scalar" and multiplying it to produce a public key.

func (*PointEd25519) MarshalBinary

func (p *PointEd25519) MarshalBinary() ([]byte, error)

func (*PointEd25519) MarshalJSON

func (p *PointEd25519) MarshalJSON() ([]byte, error)

func (*PointEd25519) MarshalText

func (p *PointEd25519) MarshalText() ([]byte, error)

func (*PointEd25519) Mul

func (p *PointEd25519) Mul(rhs Scalar) Point

func (*PointEd25519) Neg

func (p *PointEd25519) Neg() Point

func (*PointEd25519) Random

func (p *PointEd25519) Random(reader io.Reader) Point

func (*PointEd25519) Scalar

func (p *PointEd25519) Scalar() Scalar

func (*PointEd25519) Set

func (p *PointEd25519) Set(x, y *big.Int) (Point, error)

func (*PointEd25519) SetEdwardsPoint

func (p *PointEd25519) SetEdwardsPoint(pt *edwards25519.Point) *PointEd25519

func (*PointEd25519) Sub

func (p *PointEd25519) Sub(rhs Point) Point

func (*PointEd25519) SumOfProducts

func (p *PointEd25519) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointEd25519) ToAffineCompressed

func (p *PointEd25519) ToAffineCompressed() []byte

func (*PointEd25519) ToAffineUncompressed

func (p *PointEd25519) ToAffineUncompressed() []byte

func (*PointEd25519) UnmarshalBinary

func (p *PointEd25519) UnmarshalBinary(input []byte) error

func (*PointEd25519) UnmarshalJSON

func (p *PointEd25519) UnmarshalJSON(input []byte) error

func (*PointEd25519) UnmarshalText

func (p *PointEd25519) UnmarshalText(input []byte) error

func (*PointEd25519) VarTimeDoubleScalarBaseMult

func (p *PointEd25519) VarTimeDoubleScalarBaseMult(a Scalar, A Point, b Scalar) Point

type PointK256

type PointK256 struct {
	// contains filtered or unexported fields
}

func (*PointK256) Add

func (p *PointK256) Add(rhs Point) Point

func (*PointK256) CurveName

func (p *PointK256) CurveName() string

func (*PointK256) Double

func (p *PointK256) Double() Point

func (*PointK256) Equal

func (p *PointK256) Equal(rhs Point) bool

func (*PointK256) FromAffineCompressed

func (p *PointK256) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointK256) FromAffineUncompressed

func (p *PointK256) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointK256) Generator

func (p *PointK256) Generator() Point

func (*PointK256) Hash

func (p *PointK256) Hash(bytes []byte) Point

func (*PointK256) Identity

func (p *PointK256) Identity() Point

func (*PointK256) IsIdentity

func (p *PointK256) IsIdentity() bool

func (*PointK256) IsNegative

func (p *PointK256) IsNegative() bool

func (*PointK256) IsOnCurve

func (p *PointK256) IsOnCurve() bool

func (*PointK256) MarshalBinary

func (p *PointK256) MarshalBinary() ([]byte, error)

func (*PointK256) MarshalJSON

func (p *PointK256) MarshalJSON() ([]byte, error)

func (*PointK256) MarshalText

func (p *PointK256) MarshalText() ([]byte, error)

func (*PointK256) Mul

func (p *PointK256) Mul(rhs Scalar) Point

func (*PointK256) Neg

func (p *PointK256) Neg() Point

func (*PointK256) Params

func (p *PointK256) Params() *elliptic.CurveParams

func (*PointK256) Random

func (p *PointK256) Random(reader io.Reader) Point

func (*PointK256) Scalar

func (p *PointK256) Scalar() Scalar

func (*PointK256) Set

func (p *PointK256) Set(x, y *big.Int) (Point, error)

func (*PointK256) Sub

func (p *PointK256) Sub(rhs Point) Point

func (*PointK256) SumOfProducts

func (p *PointK256) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointK256) ToAffineCompressed

func (p *PointK256) ToAffineCompressed() []byte

func (*PointK256) ToAffineUncompressed

func (p *PointK256) ToAffineUncompressed() []byte

func (*PointK256) UnmarshalBinary

func (p *PointK256) UnmarshalBinary(input []byte) error

func (*PointK256) UnmarshalJSON

func (p *PointK256) UnmarshalJSON(input []byte) error

func (*PointK256) UnmarshalText

func (p *PointK256) UnmarshalText(input []byte) error

func (*PointK256) X

func (p *PointK256) X() *big.Int

func (*PointK256) Y

func (p *PointK256) Y() *big.Int

type PointP256

type PointP256 struct {
	// contains filtered or unexported fields
}

func (*PointP256) Add

func (p *PointP256) Add(rhs Point) Point

func (*PointP256) CurveName

func (p *PointP256) CurveName() string

func (*PointP256) Double

func (p *PointP256) Double() Point

func (*PointP256) Equal

func (p *PointP256) Equal(rhs Point) bool

func (*PointP256) FromAffineCompressed

func (p *PointP256) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointP256) FromAffineUncompressed

func (p *PointP256) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointP256) Generator

func (p *PointP256) Generator() Point

func (*PointP256) Hash

func (p *PointP256) Hash(bytes []byte) Point

func (*PointP256) Identity

func (p *PointP256) Identity() Point

func (*PointP256) IsIdentity

func (p *PointP256) IsIdentity() bool

func (*PointP256) IsNegative

func (p *PointP256) IsNegative() bool

func (*PointP256) IsOnCurve

func (p *PointP256) IsOnCurve() bool

func (*PointP256) MarshalBinary

func (p *PointP256) MarshalBinary() ([]byte, error)

func (*PointP256) MarshalJSON

func (p *PointP256) MarshalJSON() ([]byte, error)

func (*PointP256) MarshalText

func (p *PointP256) MarshalText() ([]byte, error)

func (*PointP256) Mul

func (p *PointP256) Mul(rhs Scalar) Point

func (*PointP256) Neg

func (p *PointP256) Neg() Point

func (*PointP256) Params

func (p *PointP256) Params() *elliptic.CurveParams

func (*PointP256) Random

func (p *PointP256) Random(reader io.Reader) Point

func (*PointP256) Scalar

func (p *PointP256) Scalar() Scalar

func (*PointP256) Set

func (p *PointP256) Set(x, y *big.Int) (Point, error)

func (*PointP256) Sub

func (p *PointP256) Sub(rhs Point) Point

func (*PointP256) SumOfProducts

func (p *PointP256) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointP256) ToAffineCompressed

func (p *PointP256) ToAffineCompressed() []byte

func (*PointP256) ToAffineUncompressed

func (p *PointP256) ToAffineUncompressed() []byte

func (*PointP256) UnmarshalBinary

func (p *PointP256) UnmarshalBinary(input []byte) error

func (*PointP256) UnmarshalJSON

func (p *PointP256) UnmarshalJSON(input []byte) error

func (*PointP256) UnmarshalText

func (p *PointP256) UnmarshalText(input []byte) error

func (*PointP256) X

func (p *PointP256) X() *big.Int

func (*PointP256) Y

func (p *PointP256) Y() *big.Int

type PointPallas

type PointPallas struct {
	// contains filtered or unexported fields
}

func (*PointPallas) Add

func (p *PointPallas) Add(rhs Point) Point

func (*PointPallas) CurveName

func (p *PointPallas) CurveName() string

func (*PointPallas) Double

func (p *PointPallas) Double() Point

func (*PointPallas) Equal

func (p *PointPallas) Equal(rhs Point) bool

func (*PointPallas) FromAffineCompressed

func (p *PointPallas) FromAffineCompressed(bytes []byte) (Point, error)

func (*PointPallas) FromAffineUncompressed

func (p *PointPallas) FromAffineUncompressed(bytes []byte) (Point, error)

func (*PointPallas) Generator

func (p *PointPallas) Generator() Point

func (*PointPallas) GetEp

func (p *PointPallas) GetEp() *Ep

func (*PointPallas) Hash

func (p *PointPallas) Hash(bytes []byte) Point

func (*PointPallas) Identity

func (p *PointPallas) Identity() Point

func (*PointPallas) IsIdentity

func (p *PointPallas) IsIdentity() bool

func (*PointPallas) IsNegative

func (p *PointPallas) IsNegative() bool

func (*PointPallas) IsOnCurve

func (p *PointPallas) IsOnCurve() bool

func (*PointPallas) MarshalBinary

func (p *PointPallas) MarshalBinary() ([]byte, error)

func (*PointPallas) MarshalJSON

func (p *PointPallas) MarshalJSON() ([]byte, error)

func (*PointPallas) MarshalText

func (p *PointPallas) MarshalText() ([]byte, error)

func (*PointPallas) Mul

func (p *PointPallas) Mul(rhs Scalar) Point

func (*PointPallas) Neg

func (p *PointPallas) Neg() Point

func (*PointPallas) Random

func (p *PointPallas) Random(reader io.Reader) Point

func (*PointPallas) Scalar

func (p *PointPallas) Scalar() Scalar

func (*PointPallas) Set

func (p *PointPallas) Set(x, y *big.Int) (Point, error)

func (*PointPallas) Sub

func (p *PointPallas) Sub(rhs Point) Point

func (*PointPallas) SumOfProducts

func (p *PointPallas) SumOfProducts(points []Point, scalars []Scalar) Point

func (*PointPallas) ToAffineCompressed

func (p *PointPallas) ToAffineCompressed() []byte

func (*PointPallas) ToAffineUncompressed

func (p *PointPallas) ToAffineUncompressed() []byte

func (*PointPallas) UnmarshalBinary

func (p *PointPallas) UnmarshalBinary(input []byte) error

func (*PointPallas) UnmarshalJSON

func (p *PointPallas) UnmarshalJSON(input []byte) error

func (*PointPallas) UnmarshalText

func (p *PointPallas) UnmarshalText(input []byte) error

func (*PointPallas) X

func (p *PointPallas) X() *fp.Fp

func (*PointPallas) Y

func (p *PointPallas) Y() *fp.Fp

type Scalar

type Scalar interface {
	// Random returns a random scalar using the provided reader
	// to retrieve bytes
	Random(reader io.Reader) Scalar
	// Hash the specific bytes in a manner to yield a
	// uniformly distributed scalar
	Hash(bytes []byte) Scalar
	// Zero returns the additive identity element
	Zero() Scalar
	// One returns the multiplicative identity element
	One() Scalar
	// IsZero returns true if this element is the additive identity element
	IsZero() bool
	// IsOne returns true if this element is the multiplicative identity element
	IsOne() bool
	// IsOdd returns true if this element is odd
	IsOdd() bool
	// IsEven returns true if this element is even
	IsEven() bool
	// New returns an element with the value equal to `value`
	New(value int) Scalar
	// Cmp returns
	// -2 if this element is in a different field than rhs
	// -1 if this element is less than rhs
	// 0 if this element is equal to rhs
	// 1 if this element is greater than rhs
	Cmp(rhs Scalar) int
	// Square returns element*element
	Square() Scalar
	// Double returns element+element
	Double() Scalar
	// Invert returns element^-1 mod p
	Invert() (Scalar, error)
	// Sqrt computes the square root of this element if it exists.
	Sqrt() (Scalar, error)
	// Cube returns element*element*element
	Cube() Scalar
	// Add returns element+rhs
	Add(rhs Scalar) Scalar
	// Sub returns element-rhs
	Sub(rhs Scalar) Scalar
	// Mul returns element*rhs
	Mul(rhs Scalar) Scalar
	// MulAdd returns element * y + z mod p
	MulAdd(y, z Scalar) Scalar
	// Div returns element*rhs^-1 mod p
	Div(rhs Scalar) Scalar
	// Neg returns -element mod p
	Neg() Scalar
	// SetBigInt returns this element set to the value of v
	SetBigInt(v *big.Int) (Scalar, error)
	// BigInt returns this element as a big integer
	BigInt() *big.Int
	// Point returns the associated point for this scalar
	Point() Point
	// Bytes returns the canonical byte representation of this scalar
	Bytes() []byte
	// SetBytes creates a scalar from the canonical representation expecting the exact number of bytes needed to represent the scalar
	SetBytes(bytes []byte) (Scalar, error)
	// SetBytesWide creates a scalar expecting double the exact number of bytes needed to represent the scalar which is reduced by the modulus
	SetBytesWide(bytes []byte) (Scalar, error)
	// Clone returns a cloned Scalar of this value
	Clone() Scalar
}

Scalar represents an element of the scalar field \mathbb{F}_q of the elliptic curve construction.

type ScalarBls12377

type ScalarBls12377 struct {
	// contains filtered or unexported fields
}

func (*ScalarBls12377) Add

func (s *ScalarBls12377) Add(rhs Scalar) Scalar

func (*ScalarBls12377) BigInt

func (s *ScalarBls12377) BigInt() *big.Int

func (*ScalarBls12377) Bytes

func (s *ScalarBls12377) Bytes() []byte

func (*ScalarBls12377) Clone

func (s *ScalarBls12377) Clone() Scalar

func (*ScalarBls12377) Cmp

func (s *ScalarBls12377) Cmp(rhs Scalar) int

func (*ScalarBls12377) Cube

func (s *ScalarBls12377) Cube() Scalar

func (*ScalarBls12377) Div

func (s *ScalarBls12377) Div(rhs Scalar) Scalar

func (*ScalarBls12377) Double

func (s *ScalarBls12377) Double() Scalar

func (*ScalarBls12377) Hash

func (s *ScalarBls12377) Hash(bytes []byte) Scalar

func (*ScalarBls12377) Invert

func (s *ScalarBls12377) Invert() (Scalar, error)

func (*ScalarBls12377) IsEven

func (s *ScalarBls12377) IsEven() bool

func (*ScalarBls12377) IsOdd

func (s *ScalarBls12377) IsOdd() bool

func (*ScalarBls12377) IsOne

func (s *ScalarBls12377) IsOne() bool

func (*ScalarBls12377) IsZero

func (s *ScalarBls12377) IsZero() bool

func (*ScalarBls12377) MarshalBinary

func (s *ScalarBls12377) MarshalBinary() ([]byte, error)

func (*ScalarBls12377) MarshalJSON

func (s *ScalarBls12377) MarshalJSON() ([]byte, error)

func (*ScalarBls12377) MarshalText

func (s *ScalarBls12377) MarshalText() ([]byte, error)

func (*ScalarBls12377) Mul

func (s *ScalarBls12377) Mul(rhs Scalar) Scalar

func (*ScalarBls12377) MulAdd

func (s *ScalarBls12377) MulAdd(y, z Scalar) Scalar

func (*ScalarBls12377) Neg

func (s *ScalarBls12377) Neg() Scalar

func (*ScalarBls12377) New

func (s *ScalarBls12377) New(value int) Scalar

func (*ScalarBls12377) One

func (s *ScalarBls12377) One() Scalar

func (*ScalarBls12377) Order

func (s *ScalarBls12377) Order() *big.Int

func (*ScalarBls12377) Point

func (s *ScalarBls12377) Point() Point

func (*ScalarBls12377) Random

func (s *ScalarBls12377) Random(reader io.Reader) Scalar

func (*ScalarBls12377) SetBigInt

func (s *ScalarBls12377) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarBls12377) SetBytes

func (s *ScalarBls12377) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarBls12377) SetBytesWide

func (s *ScalarBls12377) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarBls12377) SetPoint

func (s *ScalarBls12377) SetPoint(p Point) PairingScalar

func (*ScalarBls12377) Sqrt

func (s *ScalarBls12377) Sqrt() (Scalar, error)

func (*ScalarBls12377) Square

func (s *ScalarBls12377) Square() Scalar

func (*ScalarBls12377) Sub

func (s *ScalarBls12377) Sub(rhs Scalar) Scalar

func (*ScalarBls12377) UnmarshalBinary

func (s *ScalarBls12377) UnmarshalBinary(input []byte) error

func (*ScalarBls12377) UnmarshalJSON

func (s *ScalarBls12377) UnmarshalJSON(input []byte) error

func (*ScalarBls12377) UnmarshalText

func (s *ScalarBls12377) UnmarshalText(input []byte) error

func (*ScalarBls12377) Zero

func (s *ScalarBls12377) Zero() Scalar

type ScalarBls12377Gt

type ScalarBls12377Gt struct {
	// contains filtered or unexported fields
}

func (*ScalarBls12377Gt) Add

func (s *ScalarBls12377Gt) Add(rhs Scalar) Scalar

func (*ScalarBls12377Gt) BigInt

func (s *ScalarBls12377Gt) BigInt() *big.Int

func (*ScalarBls12377Gt) Bytes

func (s *ScalarBls12377Gt) Bytes() []byte

func (*ScalarBls12377Gt) Clone

func (s *ScalarBls12377Gt) Clone() Scalar

func (*ScalarBls12377Gt) Cmp

func (s *ScalarBls12377Gt) Cmp(rhs Scalar) int

func (*ScalarBls12377Gt) Cube

func (s *ScalarBls12377Gt) Cube() Scalar

func (*ScalarBls12377Gt) Div

func (s *ScalarBls12377Gt) Div(rhs Scalar) Scalar

func (*ScalarBls12377Gt) Double

func (s *ScalarBls12377Gt) Double() Scalar

func (*ScalarBls12377Gt) Hash

func (s *ScalarBls12377Gt) Hash(bytes []byte) Scalar

func (*ScalarBls12377Gt) Invert

func (s *ScalarBls12377Gt) Invert() (Scalar, error)

func (*ScalarBls12377Gt) IsEven

func (s *ScalarBls12377Gt) IsEven() bool

func (*ScalarBls12377Gt) IsOdd

func (s *ScalarBls12377Gt) IsOdd() bool

func (*ScalarBls12377Gt) IsOne

func (s *ScalarBls12377Gt) IsOne() bool

func (*ScalarBls12377Gt) IsZero

func (s *ScalarBls12377Gt) IsZero() bool

func (*ScalarBls12377Gt) MarshalBinary

func (s *ScalarBls12377Gt) MarshalBinary() ([]byte, error)

func (*ScalarBls12377Gt) MarshalJSON

func (s *ScalarBls12377Gt) MarshalJSON() ([]byte, error)

func (*ScalarBls12377Gt) MarshalText

func (s *ScalarBls12377Gt) MarshalText() ([]byte, error)

func (*ScalarBls12377Gt) Mul

func (s *ScalarBls12377Gt) Mul(rhs Scalar) Scalar

func (*ScalarBls12377Gt) MulAdd

func (s *ScalarBls12377Gt) MulAdd(y, z Scalar) Scalar

func (*ScalarBls12377Gt) Neg

func (s *ScalarBls12377Gt) Neg() Scalar

func (*ScalarBls12377Gt) New

func (s *ScalarBls12377Gt) New(input int) Scalar

func (*ScalarBls12377Gt) One

func (s *ScalarBls12377Gt) One() Scalar

func (*ScalarBls12377Gt) Point

func (s *ScalarBls12377Gt) Point() Point

func (*ScalarBls12377Gt) Random

func (s *ScalarBls12377Gt) Random(reader io.Reader) Scalar

func (*ScalarBls12377Gt) SetBigInt

func (s *ScalarBls12377Gt) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarBls12377Gt) SetBytes

func (s *ScalarBls12377Gt) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarBls12377Gt) SetBytesWide

func (s *ScalarBls12377Gt) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarBls12377Gt) Sqrt

func (s *ScalarBls12377Gt) Sqrt() (Scalar, error)

func (*ScalarBls12377Gt) Square

func (s *ScalarBls12377Gt) Square() Scalar

func (*ScalarBls12377Gt) Sub

func (s *ScalarBls12377Gt) Sub(rhs Scalar) Scalar

func (*ScalarBls12377Gt) UnmarshalBinary

func (s *ScalarBls12377Gt) UnmarshalBinary(input []byte) error

func (*ScalarBls12377Gt) UnmarshalJSON

func (s *ScalarBls12377Gt) UnmarshalJSON(input []byte) error

func (*ScalarBls12377Gt) UnmarshalText

func (s *ScalarBls12377Gt) UnmarshalText(input []byte) error

func (*ScalarBls12377Gt) Zero

func (s *ScalarBls12377Gt) Zero() Scalar

type ScalarBls12381

type ScalarBls12381 struct {
	Value *big.Int
	// contains filtered or unexported fields
}

func (*ScalarBls12381) Add

func (s *ScalarBls12381) Add(rhs Scalar) Scalar

func (*ScalarBls12381) BigInt

func (s *ScalarBls12381) BigInt() *big.Int

func (*ScalarBls12381) Bytes

func (s *ScalarBls12381) Bytes() []byte

func (*ScalarBls12381) Clone

func (s *ScalarBls12381) Clone() Scalar

func (*ScalarBls12381) Cmp

func (s *ScalarBls12381) Cmp(rhs Scalar) int

func (*ScalarBls12381) Cube

func (s *ScalarBls12381) Cube() Scalar

func (*ScalarBls12381) Div

func (s *ScalarBls12381) Div(rhs Scalar) Scalar

func (*ScalarBls12381) Double

func (s *ScalarBls12381) Double() Scalar

func (*ScalarBls12381) Hash

func (s *ScalarBls12381) Hash(bytes []byte) Scalar

func (*ScalarBls12381) Invert

func (s *ScalarBls12381) Invert() (Scalar, error)

func (*ScalarBls12381) IsEven

func (s *ScalarBls12381) IsEven() bool

func (*ScalarBls12381) IsOdd

func (s *ScalarBls12381) IsOdd() bool

func (*ScalarBls12381) IsOne

func (s *ScalarBls12381) IsOne() bool

func (*ScalarBls12381) IsZero

func (s *ScalarBls12381) IsZero() bool

func (*ScalarBls12381) MarshalBinary

func (s *ScalarBls12381) MarshalBinary() ([]byte, error)

func (*ScalarBls12381) MarshalJSON

func (s *ScalarBls12381) MarshalJSON() ([]byte, error)

func (*ScalarBls12381) MarshalText

func (s *ScalarBls12381) MarshalText() ([]byte, error)

func (*ScalarBls12381) Mul

func (s *ScalarBls12381) Mul(rhs Scalar) Scalar

func (*ScalarBls12381) MulAdd

func (s *ScalarBls12381) MulAdd(y, z Scalar) Scalar

func (*ScalarBls12381) Neg

func (s *ScalarBls12381) Neg() Scalar

func (*ScalarBls12381) New

func (s *ScalarBls12381) New(value int) Scalar

func (*ScalarBls12381) One

func (s *ScalarBls12381) One() Scalar

func (*ScalarBls12381) Order

func (s *ScalarBls12381) Order() *big.Int

func (*ScalarBls12381) Point

func (s *ScalarBls12381) Point() Point

func (*ScalarBls12381) Random

func (s *ScalarBls12381) Random(reader io.Reader) Scalar

func (*ScalarBls12381) SetBigInt

func (s *ScalarBls12381) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarBls12381) SetBytes

func (s *ScalarBls12381) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarBls12381) SetBytesWide

func (s *ScalarBls12381) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarBls12381) SetPoint

func (s *ScalarBls12381) SetPoint(p Point) PairingScalar

func (*ScalarBls12381) Sqrt

func (s *ScalarBls12381) Sqrt() (Scalar, error)

func (*ScalarBls12381) Square

func (s *ScalarBls12381) Square() Scalar

func (*ScalarBls12381) Sub

func (s *ScalarBls12381) Sub(rhs Scalar) Scalar

func (*ScalarBls12381) UnmarshalBinary

func (s *ScalarBls12381) UnmarshalBinary(input []byte) error

func (*ScalarBls12381) UnmarshalJSON

func (s *ScalarBls12381) UnmarshalJSON(input []byte) error

func (*ScalarBls12381) UnmarshalText

func (s *ScalarBls12381) UnmarshalText(input []byte) error

func (*ScalarBls12381) Zero

func (s *ScalarBls12381) Zero() Scalar

type ScalarBls12381Gt

type ScalarBls12381Gt struct {
	Value *bls12381.E
}

func (*ScalarBls12381Gt) Add

func (s *ScalarBls12381Gt) Add(rhs Scalar) Scalar

func (*ScalarBls12381Gt) BigInt

func (s *ScalarBls12381Gt) BigInt() *big.Int

func (*ScalarBls12381Gt) Bytes

func (s *ScalarBls12381Gt) Bytes() []byte

func (*ScalarBls12381Gt) Clone

func (s *ScalarBls12381Gt) Clone() Scalar

func (*ScalarBls12381Gt) Cmp

func (s *ScalarBls12381Gt) Cmp(rhs Scalar) int

func (*ScalarBls12381Gt) Cube

func (s *ScalarBls12381Gt) Cube() Scalar

func (*ScalarBls12381Gt) Div

func (s *ScalarBls12381Gt) Div(rhs Scalar) Scalar

func (*ScalarBls12381Gt) Double

func (s *ScalarBls12381Gt) Double() Scalar

func (*ScalarBls12381Gt) Hash

func (s *ScalarBls12381Gt) Hash(bytes []byte) Scalar

func (*ScalarBls12381Gt) Invert

func (s *ScalarBls12381Gt) Invert() (Scalar, error)

func (*ScalarBls12381Gt) IsEven

func (s *ScalarBls12381Gt) IsEven() bool

func (*ScalarBls12381Gt) IsOdd

func (s *ScalarBls12381Gt) IsOdd() bool

func (*ScalarBls12381Gt) IsOne

func (s *ScalarBls12381Gt) IsOne() bool

func (*ScalarBls12381Gt) IsZero

func (s *ScalarBls12381Gt) IsZero() bool

func (*ScalarBls12381Gt) MarshalBinary

func (s *ScalarBls12381Gt) MarshalBinary() ([]byte, error)

func (*ScalarBls12381Gt) MarshalJSON

func (s *ScalarBls12381Gt) MarshalJSON() ([]byte, error)

func (*ScalarBls12381Gt) MarshalText

func (s *ScalarBls12381Gt) MarshalText() ([]byte, error)

func (*ScalarBls12381Gt) Mul

func (s *ScalarBls12381Gt) Mul(rhs Scalar) Scalar

func (*ScalarBls12381Gt) MulAdd

func (s *ScalarBls12381Gt) MulAdd(y, z Scalar) Scalar

func (*ScalarBls12381Gt) Neg

func (s *ScalarBls12381Gt) Neg() Scalar

func (*ScalarBls12381Gt) New

func (s *ScalarBls12381Gt) New(input int) Scalar

func (*ScalarBls12381Gt) One

func (s *ScalarBls12381Gt) One() Scalar

func (*ScalarBls12381Gt) Point

func (s *ScalarBls12381Gt) Point() Point

func (*ScalarBls12381Gt) Random

func (s *ScalarBls12381Gt) Random(reader io.Reader) Scalar

func (*ScalarBls12381Gt) SetBigInt

func (s *ScalarBls12381Gt) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarBls12381Gt) SetBytes

func (s *ScalarBls12381Gt) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarBls12381Gt) SetBytesWide

func (s *ScalarBls12381Gt) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarBls12381Gt) Sqrt

func (s *ScalarBls12381Gt) Sqrt() (Scalar, error)

func (*ScalarBls12381Gt) Square

func (s *ScalarBls12381Gt) Square() Scalar

func (*ScalarBls12381Gt) Sub

func (s *ScalarBls12381Gt) Sub(rhs Scalar) Scalar

func (*ScalarBls12381Gt) UnmarshalBinary

func (s *ScalarBls12381Gt) UnmarshalBinary(input []byte) error

func (*ScalarBls12381Gt) UnmarshalJSON

func (s *ScalarBls12381Gt) UnmarshalJSON(input []byte) error

func (*ScalarBls12381Gt) UnmarshalText

func (s *ScalarBls12381Gt) UnmarshalText(input []byte) error

func (*ScalarBls12381Gt) Zero

func (s *ScalarBls12381Gt) Zero() Scalar

type ScalarEd25519

type ScalarEd25519 struct {
	// contains filtered or unexported fields
}

func (*ScalarEd25519) Add

func (s *ScalarEd25519) Add(rhs Scalar) Scalar

func (*ScalarEd25519) BigInt

func (s *ScalarEd25519) BigInt() *big.Int

func (*ScalarEd25519) Bytes

func (s *ScalarEd25519) Bytes() []byte

func (*ScalarEd25519) Clone

func (s *ScalarEd25519) Clone() Scalar

func (*ScalarEd25519) Cmp

func (s *ScalarEd25519) Cmp(rhs Scalar) int

func (*ScalarEd25519) Cube

func (s *ScalarEd25519) Cube() Scalar

func (*ScalarEd25519) Div

func (s *ScalarEd25519) Div(rhs Scalar) Scalar

func (*ScalarEd25519) Double

func (s *ScalarEd25519) Double() Scalar

func (*ScalarEd25519) GetEdwardsScalar

func (s *ScalarEd25519) GetEdwardsScalar() *edwards25519.Scalar

func (*ScalarEd25519) Hash

func (s *ScalarEd25519) Hash(bytes []byte) Scalar

func (*ScalarEd25519) Invert

func (s *ScalarEd25519) Invert() (Scalar, error)

func (*ScalarEd25519) IsEven

func (s *ScalarEd25519) IsEven() bool

func (*ScalarEd25519) IsOdd

func (s *ScalarEd25519) IsOdd() bool

func (*ScalarEd25519) IsOne

func (s *ScalarEd25519) IsOne() bool

func (*ScalarEd25519) IsZero

func (s *ScalarEd25519) IsZero() bool

func (*ScalarEd25519) MarshalBinary

func (s *ScalarEd25519) MarshalBinary() ([]byte, error)

func (*ScalarEd25519) MarshalJSON

func (s *ScalarEd25519) MarshalJSON() ([]byte, error)

func (*ScalarEd25519) MarshalText

func (s *ScalarEd25519) MarshalText() ([]byte, error)

func (*ScalarEd25519) Mul

func (s *ScalarEd25519) Mul(rhs Scalar) Scalar

func (*ScalarEd25519) MulAdd

func (s *ScalarEd25519) MulAdd(y, z Scalar) Scalar

func (*ScalarEd25519) Neg

func (s *ScalarEd25519) Neg() Scalar

func (*ScalarEd25519) New

func (s *ScalarEd25519) New(input int) Scalar

func (*ScalarEd25519) One

func (s *ScalarEd25519) One() Scalar

func (*ScalarEd25519) Point

func (s *ScalarEd25519) Point() Point

func (*ScalarEd25519) Random

func (s *ScalarEd25519) Random(reader io.Reader) Scalar

func (*ScalarEd25519) SetBigInt

func (s *ScalarEd25519) SetBigInt(x *big.Int) (Scalar, error)

func (*ScalarEd25519) SetBytes

func (s *ScalarEd25519) SetBytes(input []byte) (Scalar, error)

SetBytes takes input a 32-byte long array and returns a ed25519 scalar. The input must be 32-byte long and must be a reduced bytes.

func (*ScalarEd25519) SetBytesCanonical

func (s *ScalarEd25519) SetBytesCanonical(bytes []byte) (Scalar, error)

SetBytesCanonical uses SetCanonicalBytes of fillipo.io/edwards25519. https://github.com/FiloSottile/edwards25519/blob/v1.0.0-rc.1/scalar.go#L98 This function takes an input x and sets s = x, where x is a 32-byte little-endian encoding of s, then it returns the corresponding ed25519 scalar. If the input is not a canonical encoding of s, it returns nil and an error.

func (*ScalarEd25519) SetBytesClamping

func (s *ScalarEd25519) SetBytesClamping(bytes []byte) (Scalar, error)

SetBytesClamping uses SetBytesWithClamping of fillipo.io/edwards25519- https://github.com/FiloSottile/edwards25519/blob/v1.0.0-rc.1/scalar.go#L135 which applies the buffer pruning described in RFC 8032, Section 5.1.5 (also known as clamping) and sets bytes to the result. The input must be 32-byte long, and it is not modified. If bytes is not of the right length, SetBytesWithClamping returns nil and an error, and the receiver is unchanged.

func (*ScalarEd25519) SetBytesWide

func (s *ScalarEd25519) SetBytesWide(bytes []byte) (Scalar, error)

SetBytesWide takes input a 64-byte long byte array, reduce it and return an ed25519 scalar. It uses SetUniformBytes of fillipo.io/edwards25519 - https://github.com/FiloSottile/edwards25519/blob/v1.0.0-rc.1/scalar.go#L85 If bytes is not of the right length, it returns nil and an error

func (*ScalarEd25519) SetEdwardsScalar

func (s *ScalarEd25519) SetEdwardsScalar(sc *edwards25519.Scalar) *ScalarEd25519

func (*ScalarEd25519) Sqrt

func (s *ScalarEd25519) Sqrt() (Scalar, error)

func (*ScalarEd25519) Square

func (s *ScalarEd25519) Square() Scalar

func (*ScalarEd25519) Sub

func (s *ScalarEd25519) Sub(rhs Scalar) Scalar

func (*ScalarEd25519) UnmarshalBinary

func (s *ScalarEd25519) UnmarshalBinary(input []byte) error

func (*ScalarEd25519) UnmarshalJSON

func (s *ScalarEd25519) UnmarshalJSON(input []byte) error

func (*ScalarEd25519) UnmarshalText

func (s *ScalarEd25519) UnmarshalText(input []byte) error

func (*ScalarEd25519) Zero

func (s *ScalarEd25519) Zero() Scalar

type ScalarK256

type ScalarK256 struct {
	// contains filtered or unexported fields
}

func (*ScalarK256) Add

func (s *ScalarK256) Add(rhs Scalar) Scalar

func (*ScalarK256) BigInt

func (s *ScalarK256) BigInt() *big.Int

func (*ScalarK256) Bytes

func (s *ScalarK256) Bytes() []byte

func (*ScalarK256) Clone

func (s *ScalarK256) Clone() Scalar

func (*ScalarK256) Cmp

func (s *ScalarK256) Cmp(rhs Scalar) int

func (*ScalarK256) Cube

func (s *ScalarK256) Cube() Scalar

func (*ScalarK256) Div

func (s *ScalarK256) Div(rhs Scalar) Scalar

func (*ScalarK256) Double

func (s *ScalarK256) Double() Scalar

func (*ScalarK256) Hash

func (s *ScalarK256) Hash(bytes []byte) Scalar

func (*ScalarK256) Invert

func (s *ScalarK256) Invert() (Scalar, error)

func (*ScalarK256) IsEven

func (s *ScalarK256) IsEven() bool

func (*ScalarK256) IsOdd

func (s *ScalarK256) IsOdd() bool

func (*ScalarK256) IsOne

func (s *ScalarK256) IsOne() bool

func (*ScalarK256) IsZero

func (s *ScalarK256) IsZero() bool

func (*ScalarK256) MarshalBinary

func (s *ScalarK256) MarshalBinary() ([]byte, error)

func (*ScalarK256) MarshalJSON

func (s *ScalarK256) MarshalJSON() ([]byte, error)

func (*ScalarK256) MarshalText

func (s *ScalarK256) MarshalText() ([]byte, error)

func (*ScalarK256) Mul

func (s *ScalarK256) Mul(rhs Scalar) Scalar

func (*ScalarK256) MulAdd

func (s *ScalarK256) MulAdd(y, z Scalar) Scalar

func (*ScalarK256) Neg

func (s *ScalarK256) Neg() Scalar

func (*ScalarK256) New

func (s *ScalarK256) New(value int) Scalar

func (*ScalarK256) One

func (s *ScalarK256) One() Scalar

func (*ScalarK256) Point

func (s *ScalarK256) Point() Point

func (*ScalarK256) Random

func (s *ScalarK256) Random(reader io.Reader) Scalar

func (*ScalarK256) SetBigInt

func (s *ScalarK256) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarK256) SetBytes

func (s *ScalarK256) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarK256) SetBytesWide

func (s *ScalarK256) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarK256) Sqrt

func (s *ScalarK256) Sqrt() (Scalar, error)

func (*ScalarK256) Square

func (s *ScalarK256) Square() Scalar

func (*ScalarK256) Sub

func (s *ScalarK256) Sub(rhs Scalar) Scalar

func (*ScalarK256) UnmarshalBinary

func (s *ScalarK256) UnmarshalBinary(input []byte) error

func (*ScalarK256) UnmarshalJSON

func (s *ScalarK256) UnmarshalJSON(input []byte) error

func (*ScalarK256) UnmarshalText

func (s *ScalarK256) UnmarshalText(input []byte) error

func (*ScalarK256) Zero

func (s *ScalarK256) Zero() Scalar

type ScalarP256

type ScalarP256 struct {
	// contains filtered or unexported fields
}

func (*ScalarP256) Add

func (s *ScalarP256) Add(rhs Scalar) Scalar

func (*ScalarP256) BigInt

func (s *ScalarP256) BigInt() *big.Int

func (*ScalarP256) Bytes

func (s *ScalarP256) Bytes() []byte

func (*ScalarP256) Clone

func (s *ScalarP256) Clone() Scalar

func (*ScalarP256) Cmp

func (s *ScalarP256) Cmp(rhs Scalar) int

func (*ScalarP256) Cube

func (s *ScalarP256) Cube() Scalar

func (*ScalarP256) Div

func (s *ScalarP256) Div(rhs Scalar) Scalar

func (*ScalarP256) Double

func (s *ScalarP256) Double() Scalar

func (*ScalarP256) Hash

func (s *ScalarP256) Hash(bytes []byte) Scalar

func (*ScalarP256) Invert

func (s *ScalarP256) Invert() (Scalar, error)

func (*ScalarP256) IsEven

func (s *ScalarP256) IsEven() bool

func (*ScalarP256) IsOdd

func (s *ScalarP256) IsOdd() bool

func (*ScalarP256) IsOne

func (s *ScalarP256) IsOne() bool

func (*ScalarP256) IsZero

func (s *ScalarP256) IsZero() bool

func (*ScalarP256) MarshalBinary

func (s *ScalarP256) MarshalBinary() ([]byte, error)

func (*ScalarP256) MarshalJSON

func (s *ScalarP256) MarshalJSON() ([]byte, error)

func (*ScalarP256) MarshalText

func (s *ScalarP256) MarshalText() ([]byte, error)

func (*ScalarP256) Mul

func (s *ScalarP256) Mul(rhs Scalar) Scalar

func (*ScalarP256) MulAdd

func (s *ScalarP256) MulAdd(y, z Scalar) Scalar

func (*ScalarP256) Neg

func (s *ScalarP256) Neg() Scalar

func (*ScalarP256) New

func (s *ScalarP256) New(value int) Scalar

func (*ScalarP256) One

func (s *ScalarP256) One() Scalar

func (*ScalarP256) Point

func (s *ScalarP256) Point() Point

func (*ScalarP256) Random

func (s *ScalarP256) Random(reader io.Reader) Scalar

func (*ScalarP256) SetBigInt

func (s *ScalarP256) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarP256) SetBytes

func (s *ScalarP256) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarP256) SetBytesWide

func (s *ScalarP256) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarP256) Sqrt

func (s *ScalarP256) Sqrt() (Scalar, error)

func (*ScalarP256) Square

func (s *ScalarP256) Square() Scalar

func (*ScalarP256) Sub

func (s *ScalarP256) Sub(rhs Scalar) Scalar

func (*ScalarP256) UnmarshalBinary

func (s *ScalarP256) UnmarshalBinary(input []byte) error

func (*ScalarP256) UnmarshalJSON

func (s *ScalarP256) UnmarshalJSON(input []byte) error

func (*ScalarP256) UnmarshalText

func (s *ScalarP256) UnmarshalText(input []byte) error

func (*ScalarP256) Zero

func (s *ScalarP256) Zero() Scalar

type ScalarPallas

type ScalarPallas struct {
	// contains filtered or unexported fields
}

ScalarPallas - New interface

func (*ScalarPallas) Add

func (s *ScalarPallas) Add(rhs Scalar) Scalar

func (*ScalarPallas) BigInt

func (s *ScalarPallas) BigInt() *big.Int

func (*ScalarPallas) Bytes

func (s *ScalarPallas) Bytes() []byte

func (*ScalarPallas) Clone

func (s *ScalarPallas) Clone() Scalar

func (*ScalarPallas) Cmp

func (s *ScalarPallas) Cmp(rhs Scalar) int

func (*ScalarPallas) Cube

func (s *ScalarPallas) Cube() Scalar

func (*ScalarPallas) Div

func (s *ScalarPallas) Div(rhs Scalar) Scalar

func (*ScalarPallas) Double

func (s *ScalarPallas) Double() Scalar

func (*ScalarPallas) GetFq

func (s *ScalarPallas) GetFq() *fq.Fq

func (*ScalarPallas) Hash

func (s *ScalarPallas) Hash(bytes []byte) Scalar

func (*ScalarPallas) Invert

func (s *ScalarPallas) Invert() (Scalar, error)

func (*ScalarPallas) IsEven

func (s *ScalarPallas) IsEven() bool

func (*ScalarPallas) IsOdd

func (s *ScalarPallas) IsOdd() bool

func (*ScalarPallas) IsOne

func (s *ScalarPallas) IsOne() bool

func (*ScalarPallas) IsZero

func (s *ScalarPallas) IsZero() bool

func (*ScalarPallas) MarshalBinary

func (s *ScalarPallas) MarshalBinary() ([]byte, error)

func (*ScalarPallas) MarshalJSON

func (s *ScalarPallas) MarshalJSON() ([]byte, error)

func (*ScalarPallas) MarshalText

func (s *ScalarPallas) MarshalText() ([]byte, error)

func (*ScalarPallas) Mul

func (s *ScalarPallas) Mul(rhs Scalar) Scalar

func (*ScalarPallas) MulAdd

func (s *ScalarPallas) MulAdd(y, z Scalar) Scalar

func (*ScalarPallas) Neg

func (s *ScalarPallas) Neg() Scalar

func (*ScalarPallas) New

func (s *ScalarPallas) New(value int) Scalar

func (*ScalarPallas) One

func (s *ScalarPallas) One() Scalar

func (*ScalarPallas) Point

func (s *ScalarPallas) Point() Point

func (*ScalarPallas) Random

func (s *ScalarPallas) Random(reader io.Reader) Scalar

func (*ScalarPallas) SetBigInt

func (s *ScalarPallas) SetBigInt(v *big.Int) (Scalar, error)

func (*ScalarPallas) SetBytes

func (s *ScalarPallas) SetBytes(bytes []byte) (Scalar, error)

func (*ScalarPallas) SetBytesWide

func (s *ScalarPallas) SetBytesWide(bytes []byte) (Scalar, error)

func (*ScalarPallas) SetFq

func (s *ScalarPallas) SetFq(fq *fq.Fq) *ScalarPallas

func (*ScalarPallas) Sqrt

func (s *ScalarPallas) Sqrt() (Scalar, error)

func (*ScalarPallas) Square

func (s *ScalarPallas) Square() Scalar

func (*ScalarPallas) Sub

func (s *ScalarPallas) Sub(rhs Scalar) Scalar

func (*ScalarPallas) UnmarshalBinary

func (s *ScalarPallas) UnmarshalBinary(input []byte) error

func (*ScalarPallas) UnmarshalJSON

func (s *ScalarPallas) UnmarshalJSON(input []byte) error

func (*ScalarPallas) UnmarshalText

func (s *ScalarPallas) UnmarshalText(input []byte) error

func (*ScalarPallas) Zero

func (s *ScalarPallas) Zero() Scalar

Directories

Path Synopsis
native
pasta/fp
Autogenerated: './src/ExtractionOCaml/word_by_word_montgomery' --lang Go pasta_fp 64 '2^254 + 45560315531419706090280762371685220353'
Autogenerated: './src/ExtractionOCaml/word_by_word_montgomery' --lang Go pasta_fp 64 '2^254 + 45560315531419706090280762371685220353'
pasta/fq
Autogenerated: './src/ExtractionOCaml/word_by_word_montgomery' --lang Go pasta_fq 64 '2^254 + 45560315531506369815346746415080538113'
Autogenerated: './src/ExtractionOCaml/word_by_word_montgomery' --lang Go pasta_fq 64 '2^254 + 45560315531506369815346746415080538113'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL