curves

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README

Curves

The curves package contains implementation of various elliptic curves.

Documentation

Overview

Package curves provides implementation of various elliptic curves.

See README.md for details.

Index

Constants

View Source
const (
	// TypeI is a symmetric pairing type.
	TypeI = algebra.TypeI
	// TypeII is an asymmetric pairing type with homomorphism.
	TypeII = algebra.TypeII
	// TypeIII is an asymmetric pairing type without homomorphism.
	TypeIII = algebra.TypeIII
)

Variables

View Source
var (
	// ErrFailed represents a generic failure.
	ErrFailed = errs.New("failed")
	// ErrInvalidLength reports invalid length inputs.
	ErrInvalidLength = errs.New("invalid length")
	// ErrInvalidCoordinates reports invalid curve coordinates.
	ErrInvalidCoordinates = errs.New("invalid coordinates")
	// ErrInvalidArgument reports invalid arguments.
	ErrInvalidArgument = errs.New("invalid argument")
	// ErrSerialisation reports serialisation or deserialisation errors.
	ErrSerialisation = errs.New("serialisation error")
	// ErrNil reports nil arguments.
	ErrNil = errs.New("nil")
	// ErrRandomSample reports random sampling failures.
	ErrRandomSample = errs.New("random sample failed")
)

Functions

This section is empty.

Types

type Curve

type Curve[P Point[P, F, S], F algebra.FiniteFieldElement[F], S algebra.PrimeFieldElement[S]] interface {
	EllipticCurve[P, F, S]
	algebra.PrimeOrderEllipticCurve[P, F, S]
	HashWithDst(dst string, message []byte) (P, error)
	algebra.FiniteStructure[P]

	ScalarField() algebra.PrimeField[S]
}

type ECPoint

type ECPoint[P algebra.EllipticCurvePoint[P, F, S], F algebra.FiniteFieldElement[F], S algebra.UintLike[S]] interface {
	algebra.EllipticCurvePoint[P, F, S]
	IsPrimeSubGroupDesignatedGenerator() bool
}

type EllipticCurve

type EllipticCurve[P ECPoint[P, F, S], F algebra.FiniteFieldElement[F], S algebra.UintLike[S]] interface {
	algebra.EllipticCurve[P, F, S]
	PrimeSubGroupGenerator() P

	ScalarRing() algebra.ZModLike[S]
	BaseField() algebra.FiniteField[F]
}

type PPE

type PPE[
	P1 PairingFriendlyPoint[P1, F1, P2, F2, E, S], F1 algebra.FiniteFieldElement[F1],
	P2 PairingFriendlyPoint[P2, F2, P1, F1, E, S], F2 algebra.FiniteFieldElement[F2],
	E algebra.MultiplicativeGroupElement[E], S algebra.PrimeFieldElement[S],
] = algebra.PairingProductEvaluator[P1, F1, P2, F2, E, S]

type PairingAlgorithm

type PairingAlgorithm = algebra.PairingName

type PairingFriendlyCurve

type PairingFriendlyCurve[
	P1 PairingFriendlyPoint[P1, F1, P2, F2, E, S], F1 algebra.FiniteFieldElement[F1],
	P2 PairingFriendlyPoint[P2, F2, P1, F1, E, S], F2 algebra.FiniteFieldElement[F2],
	E algebra.MultiplicativeGroupElement[E], S algebra.PrimeFieldElement[S],
] interface {
	algebra.PairingFriendlyCurve[P1, F1, P2, F2, E, S, PairingFriendlyCurve[P2, F2, P1, F1, E, S]]
	Curve[P1, F1, S]
}

type PairingFriendlyFamily

type PairingFriendlyFamily[
	P1 PairingFriendlyPoint[P1, F1, P2, F2, E, S], F1 algebra.FiniteFieldElement[F1],
	P2 PairingFriendlyPoint[P2, F2, P1, F1, E, S], F2 algebra.FiniteFieldElement[F2],
	E algebra.MultiplicativeGroupElement[E], S algebra.PrimeFieldElement[S],
] interface {
	Name() string
	SourceSubGroup() PairingFriendlyCurve[P1, F1, P2, F2, E, S]
	TwistedSubGroup() PairingFriendlyCurve[P2, F2, P1, F1, E, S]
	TargetSubGroup() algebra.MultiplicativeGroup[E]
	GetPPE(PairingAlgorithm) (out PPE[P1, F1, P2, F2, E, S], exists bool)
}

type PairingFriendlyPoint

type PairingFriendlyPoint[
	P1 algebra.PairingFriendlyPoint[P1, F1, P2, F2, E, S], F1 algebra.FiniteFieldElement[F1],
	P2 algebra.PairingFriendlyPoint[P2, F2, P1, F1, E, S], F2 algebra.FiniteFieldElement[F2],
	E algebra.MultiplicativeGroupElement[E], S algebra.PrimeFieldElement[S],
] interface {
	algebra.PairingFriendlyPoint[P1, F1, P2, F2, E, S]
	Point[P1, F1, S]
}

type PairingType

type PairingType = algebra.PairingType

type Point

Directories

Path Synopsis
Package curve25519 implements Curve25519 group operations, field elements, scalars, and encoding helpers.
Package curve25519 implements Curve25519 group operations, field elements, scalars, and encoding helpers.
Package edwards25519 implements the Edwards25519 curve, its scalar and base fields, and point encoding.
Package edwards25519 implements the Edwards25519 curve, its scalar and base fields, and point encoding.
impl
Package impl contains low-level Edwards25519 field and point implementations plus hash-to-curve parameters.
Package impl contains low-level Edwards25519 field and point implementations plus hash-to-curve parameters.
impl
points
Package points provides point arithmetic implementations for short Weierstrass and twisted Edwards curves.
Package points provides point arithmetic implementations for short Weierstrass and twisted Edwards curves.
rfc9380
Package rfc9380 implements hash-to-curve helpers from RFC 9380.
Package rfc9380 implements hash-to-curve helpers from RFC 9380.
rfc9380/expanders
Package expanders implements XMD and XOF expanders for RFC 9380.
Package expanders implements XMD and XOF expanders for RFC 9380.
rfc9380/mappers/elligator2
Package elligator2 implements Elligator 2 mappings for Curve25519 and Edwards25519.
Package elligator2 implements Elligator 2 mappings for Curve25519 and Edwards25519.
rfc9380/mappers/sswu
Package sswu implements simplified SWU mapping and related helpers for RFC 9380.
Package sswu implements simplified SWU mapping and related helpers for RFC 9380.
traits
Package traits provides reusable traits for field and curve wrappers.
Package traits provides reusable traits for field and curve wrappers.
Package k256 implements the secp256k1 curve, field, scalar, and point types.
Package k256 implements the secp256k1 curve, field, scalar, and point types.
impl
Package impl contains low-level secp256k1 field arithmetic and point operations.
Package impl contains low-level secp256k1 field arithmetic and point operations.
Package p256 implements the NIST P-256 curve, field, scalar, and point types.
Package p256 implements the NIST P-256 curve, field, scalar, and point types.
impl
Package impl contains low-level P-256 field arithmetic and point operations.
Package impl contains low-level P-256 field arithmetic and point operations.
Package pairable provides exposes pairing-friendly curve families and shared interfaces.
Package pairable provides exposes pairing-friendly curve families and shared interfaces.
bls12381
Package bls12381 implements the BLS12-381 curve groups, fields, and pairing interfaces.
Package bls12381 implements the BLS12-381 curve groups, fields, and pairing interfaces.
bls12381/impl
Package impl contains low-level BLS12-381 field arithmetic, points, and pairing engine code.
Package impl contains low-level BLS12-381 field arithmetic, points, and pairing engine code.
Package pasta implements the Pallas and Vesta curves and their field types.
Package pasta implements the Pallas and Vesta curves and their field types.
impl
Package impl contains low-level Pallas and Vesta field arithmetic and point operations.
Package impl contains low-level Pallas and Vesta field arithmetic and point operations.

Jump to

Keyboard shortcuts

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