edwards25519

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package edwards25519 implements group logic for the twisted Edwards curve

-x^2 + y^2 = 1 + -(121665/121666)*x^2*y^2

This is better known as the Edwards curve equivalent to curve25519, and is the curve used by the Ed25519 signature scheme.

Index

Constants

This section is empty.

Variables

View Source
var B = ProjP3{
	X: radix51.FieldElement([5]uint64{1738742601995546, 1146398526822698, 2070867633025821, 562264141797630, 587772402128613}),
	Y: radix51.FieldElement([5]uint64{1801439850948184, 1351079888211148, 450359962737049, 900719925474099, 1801439850948198}),
	Z: radix51.FieldElement([5]uint64{1, 0, 0, 0, 0}),
	T: radix51.FieldElement([5]uint64{1841354044333475, 16398895984059, 755974180946558, 900171276175154, 1821297809914039}),
}

B is the Ed25519 basepoint.

View Source
var D = &radix51.FieldElement{929955233495203, 466365720129213,
	1662059464998953, 2033849074728123, 1442794654840575}

D is a constant in the curve equation.

Functions

This section is empty.

Types

type AffineCached

type AffineCached struct {
	YplusX, YminusX, T2d radix51.FieldElement
}

func (*AffineCached) CondNeg

func (v *AffineCached) CondNeg(cond int) *AffineCached

CondNeg negates v if cond == 1 and leaves it unchanged if cond == 0.

func (*AffineCached) FromP3

func (v *AffineCached) FromP3(p *ProjP3) *AffineCached

func (*AffineCached) Select

func (v *AffineCached) Select(a, b *AffineCached, cond int) *AffineCached

Select sets v to a if cond == 1 and to b if cond == 0.

func (*AffineCached) Zero

func (v *AffineCached) Zero() *AffineCached

type ProjCached

type ProjCached struct {
	YplusX, YminusX, Z, T2d radix51.FieldElement
}

func (*ProjCached) CondNeg

func (v *ProjCached) CondNeg(cond int) *ProjCached

CondNeg negates v if cond == 1 and leaves it unchanged if cond == 0.

func (*ProjCached) FromP3

func (v *ProjCached) FromP3(p *ProjP3) *ProjCached

func (*ProjCached) Select

func (v *ProjCached) Select(a, b *ProjCached, cond int) *ProjCached

Select sets v to a if cond == 1 and to b if cond == 0.

func (*ProjCached) Zero

func (v *ProjCached) Zero() *ProjCached

type ProjP1xP1

type ProjP1xP1 struct {
	X, Y, Z, T radix51.FieldElement
}

func (*ProjP1xP1) Add

func (v *ProjP1xP1) Add(p *ProjP3, q *ProjCached) *ProjP1xP1

func (*ProjP1xP1) AddAffine

func (v *ProjP1xP1) AddAffine(p *ProjP3, q *AffineCached) *ProjP1xP1

func (*ProjP1xP1) Double

func (v *ProjP1xP1) Double(p *ProjP2) *ProjP1xP1

func (*ProjP1xP1) Sub

func (v *ProjP1xP1) Sub(p *ProjP3, q *ProjCached) *ProjP1xP1

func (*ProjP1xP1) SubAffine

func (v *ProjP1xP1) SubAffine(p *ProjP3, q *AffineCached) *ProjP1xP1

func (*ProjP1xP1) Zero

func (v *ProjP1xP1) Zero() *ProjP1xP1

type ProjP2

type ProjP2 struct {
	X, Y, Z radix51.FieldElement
}

func (*ProjP2) FromP1xP1

func (v *ProjP2) FromP1xP1(p *ProjP1xP1) *ProjP2

func (*ProjP2) FromP3

func (v *ProjP2) FromP3(p *ProjP3) *ProjP2

func (*ProjP2) Zero

func (v *ProjP2) Zero() *ProjP2

type ProjP3

type ProjP3 struct {
	X, Y, Z, T radix51.FieldElement
}

func (*ProjP3) Add

func (v *ProjP3) Add(p, q *ProjP3) *ProjP3

func (*ProjP3) BasepointMul

func (v *ProjP3) BasepointMul(x *scalar.Scalar) *ProjP3

Set v to x*B, where B is the Ed25519 basepoint, and return v.

The scalar multiplication is done in constant time.

func (*ProjP3) FromP1xP1

func (v *ProjP3) FromP1xP1(p *ProjP1xP1) *ProjP3

func (*ProjP3) FromP2

func (v *ProjP3) FromP2(p *ProjP2) *ProjP3

func (*ProjP3) MultiscalarMul

func (v *ProjP3) MultiscalarMul(scalars []scalar.Scalar, points []*ProjP3) *ProjP3

Set v to the result of a multiscalar multiplication and return v.

The multiscalar multiplication is sum(scalars[i]*points[i]).

The multiscalar multiplication is performed in constant time.

func (*ProjP3) Neg

func (v *ProjP3) Neg(p *ProjP3) *ProjP3

func (*ProjP3) ScalarMul

func (v *ProjP3) ScalarMul(x *scalar.Scalar, q *ProjP3) *ProjP3

Set v to x*Q, and return v. v and q may alias.

The scalar multiplication is done in constant time.

func (*ProjP3) Set

func (v *ProjP3) Set(u *ProjP3) *ProjP3

func (*ProjP3) Sub

func (v *ProjP3) Sub(p, q *ProjP3) *ProjP3

func (*ProjP3) VartimeDoubleBaseMul

func (v *ProjP3) VartimeDoubleBaseMul(a *scalar.Scalar, A *ProjP3, b *scalar.Scalar) *ProjP3

Set v to a*A + b*B, where B is the Ed25519 basepoint, and return v.

The scalar multiplication is done in variable time.

func (*ProjP3) VartimeMultiscalarMul

func (v *ProjP3) VartimeMultiscalarMul(scalars []scalar.Scalar, points []*ProjP3) *ProjP3

Set v to the result of a multiscalar multiplication and return v.

The multiscalar multiplication is sum(scalars[i]*points[i]).

The multiscalar multiplication is performed in variable time.

func (*ProjP3) Zero

func (v *ProjP3) Zero() *ProjP3

Jump to

Keyboard shortcuts

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