twistededwards

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 15 Imported by: 14

Documentation

Overview

Package twistededwards implements the arithmetic of twisted Edwards curves in native fields. This uses associated twisted Edwards curves defined over the scalar field of the SNARK curves.

Examples: Jubjub, Bandersnatch (a twisted Edwards) is defined over BLS12-381's scalar field Baby-Jubjub (a twisted Edwards) is defined over BN254's salar fields

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHints added in v0.12.0

func GetHints() []solver.Hint

func GetSnarkField

func GetSnarkField(id twistededwards.ID) (*big.Int, error)

GetSnarkField returns the matching snark curve for a twisted edwards curve

Types

type Curve

type Curve interface {
	Params() *CurveParams
	Endo() *EndoParams
	Add(p1, p2 Point) Point
	Double(p1 Point) Point
	Neg(p1 Point) Point
	AssertIsOnCurve(p1 Point)
	ScalarMul(p1 Point, scalar frontend.Variable) Point
	DoubleBaseScalarMul(p1, p2 Point, s1, s2 frontend.Variable) Point
	API() frontend.API
}

Curve methods implemented by a twisted edwards curve inside a circuit

func NewEdCurve

func NewEdCurve(api frontend.API, id twistededwards.ID) (Curve, error)

NewEdCurve returns a new Edwards curve

type CurveParams

type CurveParams struct {
	A, D, Cofactor, Order *big.Int
	Base                  [2]*big.Int // base point coordinates
}

CurveParams twisted edwards curve parameters ax^2 + y^2 = 1 + d*x^2*y^2 Matches gnark-crypto curve specific params

func GetCurveParams

func GetCurveParams(id twistededwards.ID) (*CurveParams, error)

type EndoParams

type EndoParams struct {
	Endo   [2]*big.Int
	Lambda *big.Int
}

EndoParams endomorphism parameters for the curve, if they exist

type Point

type Point struct {
	X, Y frontend.Variable
}

Point represent a pair of X, Y coordinates inside a circuit

Jump to

Keyboard shortcuts

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