Documentation ¶
Overview ¶
Package fourq provides elliptic curve operations over FourQ curve.
FourQ is a high-speed elliptic curve at the 128-bit security level. This package contains an AMD64-optimized implementation. In particular, this package does not implement FourQ's endomorphisms or lattice reduction techniques.
References:
Index ¶
- Constants
- type CurveParams
- type Fp
- type Fq
- type Point
- func (P *Point) Add(Q, R *Point)
- func (P *Point) IsIdentity() bool
- func (P *Point) IsOnCurve() bool
- func (P *Point) Marshal(out *[Size]byte)
- func (P *Point) ScalarBaseMult(k *[Size]byte)
- func (P *Point) ScalarMult(k *[Size]byte, Q *Point)
- func (P *Point) SetGenerator()
- func (P *Point) SetIdentity()
- func (P *Point) Unmarshal(in *[Size]byte) bool
Constants ¶
const Size = 32
Size of scalars used for point multiplication.
const SizeFp = 16
SizeFp is the length in bytes to represent an element in the base field.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurveParams ¶
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. }
CurveParams contains the parameters of the elliptic curve.
type Fq ¶
type Fq [2]Fp
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 Point ¶
type Point struct{ X, Y Fq }
Point represents an affine point of the curve. The identity is (0,1).
func (*Point) IsIdentity ¶
IsIdentity returns true if P is the identity element.
func (*Point) ScalarBaseMult ¶
ScalarBaseMult calculates P = k*G, where G is the generator point.
func (*Point) ScalarMult ¶
ScalarMult calculates P = k*Q, where Q is an N-torsion point.
func (*Point) SetGenerator ¶
func (P *Point) SetGenerator()
SetGenerator assigns to P the generator point G.
func (*Point) SetIdentity ¶
func (P *Point) SetIdentity()
SetIdentity assigns to P the identity element.