twistededwards

package
v0.5.1-hotfixes Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EdCurve

type EdCurve struct {
	A, D, Cofactor, Order, BaseX, BaseY, Modulus big.Int
	ID                                           ecc.ID
}

EdCurve stores the info on the chosen edwards curve

func NewEdCurve

func NewEdCurve(id ecc.ID) (EdCurve, error)

NewEdCurve returns an Edwards curve parameters

type Point

type Point struct {
	X, Y frontend.Variable
}

Point point on a twisted Edwards curve in a Snark cs

func (*Point) AddFixedPoint

func (p *Point) AddFixedPoint(cs *frontend.ConstraintSystem, p1 *Point, x, y interface{}, curve EdCurve) *Point

AddFixedPoint Adds two points, among which is one fixed point (the base), on a twisted edwards curve (eg jubjub) p1, base, ecurve are respectively: the point to add, a known base point, and the parameters of the twisted edwards curve

func (*Point) AddGeneric

func (p *Point) AddGeneric(cs *frontend.ConstraintSystem, p1, p2 *Point, curve EdCurve) *Point

AddGeneric Adds two points on a twisted edwards curve (eg jubjub) p1, p2, c are respectively: the point to add, a known base point, and the parameters of the twisted edwards curve

func (*Point) Double

func (p *Point) Double(cs *frontend.ConstraintSystem, p1 *Point, curve EdCurve) *Point

Double doubles a points in SNARK coordinates IMPORTANT: it assumes the twisted Edwards is reduced (a=-1)

func (*Point) MustBeOnCurve

func (p *Point) MustBeOnCurve(cs *frontend.ConstraintSystem, curve EdCurve)

MustBeOnCurve checks if a point is on the reduced twisted Edwards curve -x^2 + y^2 = 1 + d*x^2*y^2.

func (*Point) Neg added in v0.5.0

func (p *Point) Neg(cs *frontend.ConstraintSystem, p1 *Point) *Point

Neg computes the negative of a point in SNARK coordinates

func (*Point) ScalarMulFixedBase

func (p *Point) ScalarMulFixedBase(cs *frontend.ConstraintSystem, x, y interface{}, scalar frontend.Variable, curve EdCurve) *Point

ScalarMulFixedBase computes the scalar multiplication of a point on a twisted Edwards curve x, y: coordinates of the base point curve: parameters of the Edwards curve scal: scalar as a SNARK constraint Standard left to right double and add

func (*Point) ScalarMulNonFixedBase

func (p *Point) ScalarMulNonFixedBase(cs *frontend.ConstraintSystem, p1 *Point, scalar frontend.Variable, curve EdCurve) *Point

ScalarMulNonFixedBase computes the scalar multiplication of a point on a twisted Edwards curve p1: base point (as snark point) curve: parameters of the Edwards curve scal: scalar as a SNARK constraint Standard left to right double and add

Jump to

Keyboard shortcuts

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