fourq

package
v0.0.0-...-4223e8c Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

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

View Source
const Size = 32

Size of scalars used for point multiplication.

View Source
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.

func Params

func Params() *CurveParams

Params returns the parameters for the curve.

type Fp

type Fp [SizeFp]byte

Fp is an element (in littleEndian order) of prime field GF(2^127-1).

func (*Fp) String

func (f *Fp) String() string

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.

func (*Fq) String

func (e *Fq) String() string

type Point

type Point struct{ X, Y Fq }

Point represents an affine point of the curve. The identity is (0,1).

func (*Point) Add

func (P *Point) Add(Q, R *Point)

Add calculates a point addition P = Q + R.

func (*Point) IsIdentity

func (P *Point) IsIdentity() bool

IsIdentity returns true if P is the identity element.

func (*Point) IsOnCurve

func (P *Point) IsOnCurve() bool

IsOnCurve reports whether the given P=(x,y) lies on the curve.

func (*Point) Marshal

func (P *Point) Marshal(out *[Size]byte)

Marshal encodes a point P into out buffer.

func (*Point) ScalarBaseMult

func (P *Point) ScalarBaseMult(k *[Size]byte)

ScalarBaseMult calculates P = k*G, where G is the generator point.

func (*Point) ScalarMult

func (P *Point) ScalarMult(k *[Size]byte, Q *Point)

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.

func (*Point) Unmarshal

func (P *Point) Unmarshal(in *[Size]byte) bool

Unmarshal retrieves a point P from the input buffer. On success, returns true.

Jump to

Keyboard shortcuts

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