twistededwards

package
v0.2.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EdCurveGadget

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

EdCurveGadget stores the info on the chosen edwards curve

func NewEdCurveGadget

func NewEdCurveGadget(id gurvy.ID) (EdCurveGadget, error)

NewEdCurveGadget returns an Edwards curve parameters

type PointGadget

type PointGadget struct {
	X, Y *frontend.Constraint
}

PointGadget point on a twisted Edwards curve in a Snark circuit

func NewPointGadget

func NewPointGadget(circuit *frontend.CS, _x, _y interface{}) PointGadget

NewPointGadget creates a new instance of Point if x and y are not of type frontend.Constraint they must be fr.Element and will be allocated (ALLOCATE) in the circuit

func (*PointGadget) AddFixedPoint

func (p *PointGadget) AddFixedPoint(circuit *frontend.CS, p1 *PointGadget, x, y interface{}, curve EdCurveGadget) *PointGadget

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 (*PointGadget) AddGeneric

func (p *PointGadget) AddGeneric(circuit *frontend.CS, p1, p2 *PointGadget, curve EdCurveGadget) *PointGadget

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 (*PointGadget) Double

func (p *PointGadget) Double(circuit *frontend.CS, p1 *PointGadget, curve EdCurveGadget) *PointGadget

Double doubles a points in SNARK coordinates

func (*PointGadget) MustBeOnCurveGadget

func (p *PointGadget) MustBeOnCurveGadget(circuit *frontend.CS, curve EdCurveGadget)

MustBeOnCurveGadget checks if a point is on the twisted Edwards curve ax^2 + y^2 = 1 + d*x^2*y^2

func (*PointGadget) ScalarMulFixedBase

func (p *PointGadget) ScalarMulFixedBase(circuit *frontend.CS, x, y interface{}, scalar *frontend.Constraint, curve EdCurveGadget) *PointGadget

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 TODO passing a point a x, y interface{} is a bit ugly, but on the other hand creating a special struct{x, y interface{}} only for general point seems too much

func (*PointGadget) ScalarMulNonFixedBase

func (p *PointGadget) ScalarMulNonFixedBase(circuit *frontend.CS, p1 *PointGadget, scalar *frontend.Constraint, curve EdCurveGadget) *PointGadget

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