Size of scalars used for point multiplication.
const Size = 32
SizeFp is the length in bytes to represent an element in the base field.
const SizeFp = 16
CurveParams contains the parameters of the elliptic curve.
type CurveParams struct { Name string // The canonical name of the curve. P *big.Int // The order of the underlying field Fp. N *big.Int // The order of the generator point. G Point // This is the generator point. }
func Params() *CurveParams
Params returns the parameters for the curve.
Fp is an element (in littleEndian order) of prime field GF(2^127-1).
type Fp [SizeFp]byte
func (f *Fp) String() string
Fq implements operations of a field of size q=p^2 as a quadratic extension of the base field where i^2=-1. An element in Fq is represented as f[0]+f[1]*i, where f[0],f[1] are in Fp.
type Fq [2]Fp
func (e *Fq) String() string
Point represents an affine point of the curve. The identity is (0,1).
type Point struct{ X, Y Fq }
func (P *Point) Add(Q, R *Point)
Add calculates a point addition P = Q + R.
func (P *Point) IsIdentity() bool
IsIdentity returns true if P is the identity element.
func (P *Point) IsOnCurve() bool
IsOnCurve reports whether the given P=(x,y) lies on the curve.
func (P *Point) Marshal(out *[Size]byte)
Marshal encodes a point P into out buffer.
func (P *Point) ScalarBaseMult(k *[Size]byte)
ScalarBaseMult calculates P = k*G, where G is the generator point.
func (P *Point) ScalarMult(k *[Size]byte, Q *Point)
ScalarMult calculates P = k*Q, where Q is an N-torsion point.
func (P *Point) SetGenerator()
SetGenerator assigns to P the generator point G.
func (P *Point) SetIdentity()
SetIdentity assigns to P the identity element.
func (P *Point) Unmarshal(in *[Size]byte) bool
Unmarshal retrieves a point P from the input buffer. On success, returns true.