ed25519

package
v0.0.0-...-bf1e635 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Copyright 2013 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeAdd

func FeAdd(out, a, b *FieldElement)

func FeCMove

func FeCMove(f, g *FieldElement, b int32)

Replace (f,g) with (g,g) if b == 1; replace (f,g) with (f,g) if b == 0.

Preconditions: b in {0,1}.

func FeCopy

func FeCopy(dst, src *FieldElement)

func FeFromBytes

func FeFromBytes(v *FieldElement, buf []byte)

func FeInvSqrt

func FeInvSqrt(out, a *FieldElement)

Sets fe to 1/sqrt(a). Requires a to be a square. Returns fe.

func FeInvert

func FeInvert(out, z *FieldElement)

func FeIsNegative

func FeIsNegative(f *FieldElement) byte

func FeIsNonZero

func FeIsNonZero(f *FieldElement) int32

func FeMul

func FeMul(out, a, b *FieldElement)

FeMul calculates out = a * b.

func FeNeg

func FeNeg(out, a *FieldElement)

FeNeg sets out = -a

func FeOne

func FeOne(fe *FieldElement)

func FeReduce

func FeReduce(t, v *FieldElement)

func FeSqrt

func FeSqrt(out, a *FieldElement)

Sets fe to sqrt(a). Requires a to be a square. Returns fe.

func FeSquare

func FeSquare(out, a *FieldElement)

FeSquare calculates out = a * a.

func FeSquare2

func FeSquare2(out, a *FieldElement)

FeSquare2 calculates out = 2 * a * a.

func FeSub

func FeSub(out, a, b *FieldElement)

FeSub sets out = a - b

func FeToBytes

func FeToBytes(r *[32]byte, v *FieldElement)

func FeZero

func FeZero(fe *FieldElement)

func GeScalarMult

func GeScalarMult(h *ExtendedGroupElement, a *[32]byte, A *ExtendedGroupElement)

geScalarMult computes h = a*B, where

a = a[0]+256*a[1]+...+256^31 a[31]
B is the Ed25519 base point (x,4/5) with x positive.

Preconditions:

a[31] <= 127

func GeScalarMultBase

func GeScalarMultBase(h *ExtendedGroupElement, a *[32]byte)

geScalarMultBase computes h = a*B, where

a = a[0]+256*a[1]+...+256^31 a[31]
B is the Ed25519 base point (x,4/5) with x positive.

Preconditions:

a[31] <= 127

func GeScalarMultVartime

func GeScalarMultVartime(h *ExtendedGroupElement, a *[32]byte, A *ExtendedGroupElement)

Types

type CachedGroupElement

type CachedGroupElement struct {
	Z, T2d FieldElement
	// contains filtered or unexported fields
}

func (*CachedGroupElement) CMove

Set to u conditionally based on b

func (*CachedGroupElement) Neg

Set to negative of t

func (*CachedGroupElement) Zero

func (r *CachedGroupElement) Zero()

type CompletedGroupElement

type CompletedGroupElement struct {
	X, Y, Z, T FieldElement
}

func (*CompletedGroupElement) Add

geAdd

func (*CompletedGroupElement) MixedAdd

func (*CompletedGroupElement) MixedSub

func (*CompletedGroupElement) Sub

geSub

func (*CompletedGroupElement) ToExtended

func (c *CompletedGroupElement) ToExtended(r *ExtendedGroupElement)

func (*CompletedGroupElement) ToProjective

func (c *CompletedGroupElement) ToProjective(r *ProjectiveGroupElement)

type ExtendedGroupElement

type ExtendedGroupElement struct {
	X, Y, Z, T FieldElement
}

func G

func (*ExtendedGroupElement) Double

func (*ExtendedGroupElement) FromBytes

func (p *ExtendedGroupElement) FromBytes(s []byte) bool

func (*ExtendedGroupElement) Neg

func (*ExtendedGroupElement) String

func (p *ExtendedGroupElement) String() string

func (*ExtendedGroupElement) ToBytes

func (p *ExtendedGroupElement) ToBytes(s *[32]byte)

func (*ExtendedGroupElement) ToCached

func (p *ExtendedGroupElement) ToCached(r *CachedGroupElement)

func (*ExtendedGroupElement) ToProjective

func (p *ExtendedGroupElement) ToProjective(r *ProjectiveGroupElement)

func (*ExtendedGroupElement) Zero

func (p *ExtendedGroupElement) Zero()

type FieldElement

type FieldElement [5]uint64

FieldElement represents an element of the field GF(2^255-19). An element t represents the integer t[0] + t[1]*2^51 + t[2]*2^102 + t[3]*2^153 + t[4]*2^204.

func (*FieldElement) Equals

func (fe *FieldElement) Equals(a *FieldElement) bool

Returns whether fe equals a.

func (*FieldElement) IsNegativeI

func (fe *FieldElement) IsNegativeI() int32

Returns 1 if fe is negative, otherwise 0.

func (*FieldElement) IsNonZeroI

func (fe *FieldElement) IsNonZeroI() int32

Returns 1 if fe is non-zero, otherwise 0.

func (*FieldElement) IsOneI

func (fe *FieldElement) IsOneI() int32

Returns 1 if fe is equal to one, otherwise 0.

func (*FieldElement) String

func (fe *FieldElement) String() string

type PreComputedGroupElement

type PreComputedGroupElement struct {
	// contains filtered or unexported fields
}

func (*PreComputedGroupElement) CMove

Set to u conditionally based on b

func (*PreComputedGroupElement) Neg

Set to negative of t

func (*PreComputedGroupElement) Zero

func (p *PreComputedGroupElement) Zero()

type ProjectiveGroupElement

type ProjectiveGroupElement struct {
	X, Y, Z FieldElement
}

func (*ProjectiveGroupElement) Double

func (*ProjectiveGroupElement) ToBytes

func (p *ProjectiveGroupElement) ToBytes(s *[32]byte)

func (*ProjectiveGroupElement) Zero

func (p *ProjectiveGroupElement) Zero()

Jump to

Keyboard shortcuts

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