twistededwards

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurveParams

type CurveParams struct {
	A, D     fr.Element // in Montgomery form
	Cofactor fr.Element // not in Montgomery form
	Order    big.Int
	Base     Point
}

CurveParams curve parameters: ax^2 + y^2 = 1 + d*x^2*y^2

func GetEdwardsCurve

func GetEdwardsCurve() CurveParams

GetEdwardsCurve returns the twisted Edwards curve on BN256's Fr

type Point

type Point struct {
	X, Y fr.Element
}

Point point on a twisted Edwards curve

func NewPoint

func NewPoint(x, y fr.Element) Point

NewPoint creates a new instance of Point

func (*Point) Add

func (p *Point) Add(p1, p2 *Point) *Point

Add adds two points (x,y), (u,v) on a twisted Edwards curve with parameters a, d modifies p

func (*Point) Double

func (p *Point) Double(p1 *Point) *Point

Double doubles point (x,y) on a twisted Edwards curve with parameters a, d modifies p

func (*Point) Equal added in v0.3.6

func (p *Point) Equal(p1 *Point) bool

Equal returns true if p=p1 false otherwise

func (*Point) FromProj added in v0.2.0

func (p *Point) FromProj(p1 *PointProj) *Point

FromProj sets p in affine from p in projective

func (*Point) IsOnCurve

func (p *Point) IsOnCurve() bool

IsOnCurve checks if a point is on the twisted Edwards curve

func (*Point) Neg added in v0.3.6

func (p *Point) Neg(p1 *Point) *Point

Neg negates point (x,y) on a twisted Edwards curve with parameters a, d modifies p

func (*Point) ScalarMul

func (p *Point) ScalarMul(p1 *Point, scalar *big.Int) *Point

ScalarMul scalar multiplication of a point p1 points on the twisted Edwards curve c parameters of the twisted Edwards curve scal scalar NOT in Montgomery form modifies p func (p *Point) ScalarMul(p1 *Point, scalar fr.Element) *Point {

func (*Point) Set added in v0.3.6

func (p *Point) Set(p1 *Point) *Point

Set sets p to p1 and return it

type PointProj added in v0.2.0

type PointProj struct {
	X, Y, Z fr.Element
}

PointProj point in projective coordinates

func (*PointProj) Add added in v0.2.0

func (p *PointProj) Add(p1, p2 *PointProj) *PointProj

Add adds points in projective coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html

func (*PointProj) Double added in v0.2.0

func (p *PointProj) Double(p1 *PointProj) *PointProj

Double adds points in projective coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html

func (*PointProj) Equal added in v0.3.6

func (p *PointProj) Equal(p1 *PointProj) bool

Equal returns true if p=p1 false otherwise If one point is on the affine chart Z=0 it returns false

func (*PointProj) FromAffine added in v0.2.0

func (p *PointProj) FromAffine(p1 *Point) *PointProj

FromAffine sets p in projective from p in affine

func (*PointProj) Neg added in v0.3.6

func (p *PointProj) Neg(p1 *PointProj) *PointProj

Neg sets p to -p1 and returns it

func (*PointProj) Set added in v0.2.0

func (p *PointProj) Set(p1 *PointProj) *PointProj

Set sets p to p1 and return it

Jump to

Keyboard shortcuts

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