twistededwards

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 22

Documentation

Overview

Package twistededwards provides bw6-633's twisted edwards "companion curve" defined on fr.

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
	Cofactor fr.Element
	Order    big.Int
	Base     PointAffine
}

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 bw6-633/Fr

type PointAffine

type PointAffine struct {
	X, Y fr.Element
}

PointAffine point on a twisted Edwards curve

func NewPointAffine

func NewPointAffine(x, y fr.Element) PointAffine

NewPointAffine creates a new instance of PointAffine

func (*PointAffine) Add

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

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

func (*PointAffine) Bytes

func (p *PointAffine) Bytes() [sizePointCompressed]byte

Bytes returns the compressed point as a byte array Follows https://tools.ietf.org/html/rfc8032#section-3.1, as the twisted Edwards implementation is primarily used for eddsa.

func (*PointAffine) Double

func (p *PointAffine) Double(p1 *PointAffine) *PointAffine

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

func (*PointAffine) Equal

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

Equal returns true if p=p1 false otherwise

func (*PointAffine) FromExtended added in v0.6.1

func (p *PointAffine) FromExtended(p1 *PointExtended) *PointAffine

FromExtended sets p in affine from p in extended coordinates

func (*PointAffine) FromProj

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

FromProj sets p in affine from p in projective

func (*PointAffine) IsOnCurve

func (p *PointAffine) IsOnCurve() bool

IsOnCurve checks if a point is on the twisted Edwards curve

func (*PointAffine) IsZero added in v0.6.1

func (p *PointAffine) IsZero() bool

IsZero returns true if p=0 false otherwise

func (*PointAffine) Marshal

func (p *PointAffine) Marshal() []byte

Marshal converts p to a byte slice

func (*PointAffine) Neg

func (p *PointAffine) Neg(p1 *PointAffine) *PointAffine

Neg sets p to -p1 and returns it

func (*PointAffine) ScalarMultiplication added in v0.8.0

func (p *PointAffine) ScalarMultiplication(p1 *PointAffine, scalar *big.Int) *PointAffine

ScalarMultiplication scalar multiplication of a point p1 in affine coordinates with a scalar in big.Int

func (*PointAffine) Set

func (p *PointAffine) Set(p1 *PointAffine) *PointAffine

Set sets p to p1 and return it

func (*PointAffine) SetBytes

func (p *PointAffine) SetBytes(buf []byte) (int, error)

SetBytes sets p from buf len(buf) >= sizePointCompressed buf contains the Y coordinate masked with a parity bit to recompute the X coordinate from the curve equation. See Bytes() and https://tools.ietf.org/html/rfc8032#section-3.1 Returns the number of read bytes and an error if the buffer is too short.

func (*PointAffine) Unmarshal

func (p *PointAffine) Unmarshal(b []byte) error

Unmarshal alias to SetBytes()

type PointExtended added in v0.6.1

type PointExtended struct {
	X, Y, Z, T fr.Element
}

PointExtended point in extended coordinates

func (*PointExtended) Add added in v0.6.1

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

Add adds points in extended coordinates See https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd

func (*PointExtended) Double added in v0.6.1

func (p *PointExtended) Double(p1 *PointExtended) *PointExtended

Double adds points in extended coordinates Dedicated doubling https://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd

func (*PointExtended) Equal added in v0.6.1

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

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

func (*PointExtended) FromAffine added in v0.6.1

func (p *PointExtended) FromAffine(p1 *PointAffine) *PointExtended

FromAffine sets p in projective from p in affine

func (*PointExtended) IsZero added in v0.6.1

func (p *PointExtended) IsZero() bool

IsZero returns true if p=0 false otherwise

func (*PointExtended) MixedAdd added in v0.6.1

func (p *PointExtended) MixedAdd(p1 *PointExtended, p2 *PointAffine) *PointExtended

MixedAdd adds a point in extended coordinates to a point in affine coordinates See https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-madd-2008-hwcd-2

func (*PointExtended) MixedDouble added in v0.6.1

func (p *PointExtended) MixedDouble(p1 *PointExtended) *PointExtended

MixedDouble adds points in extended coordinates Dedicated mixed doubling https://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-mdbl-2008-hwcd

func (*PointExtended) Neg added in v0.6.1

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

func (*PointExtended) ScalarMultiplication added in v0.8.0

func (p *PointExtended) ScalarMultiplication(p1 *PointExtended, scalar *big.Int) *PointExtended

ScalarMultiplication scalar multiplication of a point p1 in extended coordinates with a scalar in big.Int

func (*PointExtended) Set added in v0.6.1

Set sets p to p1 and return it

type PointProj

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

PointProj point in projective coordinates

func (*PointProj) Add

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

Add adds points in projective coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-add-2008-bbjlp

func (*PointProj) Double

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

Double adds points in projective coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#doubling-dbl-2008-bbjlp

func (*PointProj) Equal

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

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

FromAffine sets p in projective from p in affine

func (*PointProj) IsZero added in v0.6.1

func (p *PointProj) IsZero() bool

IsZero returns true if p=0 false otherwise

func (*PointProj) MixedAdd added in v0.5.2

func (p *PointProj) MixedAdd(p1 *PointProj, p2 *PointAffine) *PointProj

MixedAdd adds a point in projective to a point in affine coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-madd-2008-bbjlp

func (*PointProj) Neg

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

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

func (*PointProj) ScalarMultiplication added in v0.8.0

func (p *PointProj) ScalarMultiplication(p1 *PointProj, scalar *big.Int) *PointProj

ScalarMultiplication scalar multiplication of a point p1 in projective coordinates with a scalar in big.Int

func (*PointProj) Set

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

Set sets p to p1 and return it

Directories

Path Synopsis
Package eddsa provides EdDSA signature scheme on bw6-633's twisted edwards curve.
Package eddsa provides EdDSA signature scheme on bw6-633's twisted edwards curve.

Jump to

Keyboard shortcuts

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