edwards448

package
v1.0.2065 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

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

Point represents a point on the edwards25519 curve.

This type works similarly to math/big.Int, and all arguments and receivers are allowed to alias.

The zero value is NOT valid, and it may be used only as a receiver.

func NewGeneratorPoint

func NewGeneratorPoint() *Point

NewGeneratorPoint returns a new Point set to the canonical generator.

func NewIdentityPoint

func NewIdentityPoint() *Point

NewIdentityPoint returns a new Point set to the identity.

func (*Point) Add

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

func (*Point) Bytes

func (v *Point) Bytes() []byte

Bytes returns the canonical 57-byte encoding of v, according to RFC 8032, Section 5.2.2.

func (*Point) CondNeg

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

func (*Point) Double

func (v *Point) Double(u *Point) *Point

func (*Point) Equal

func (v *Point) Equal(u *Point) int

Equal returns 1 if v is equivalent to u, and 0 otherwise.

func (*Point) Negate

func (v *Point) Negate(p *Point) *Point

Negate sets v = -p, and returns v.

func (*Point) ScalarBaseMult

func (v *Point) ScalarBaseMult(x *Scalar) *Point

ScalarBaseMult sets v = x * B, where B is the canonical generator, and returns v.

func (*Point) ScalarMult

func (v *Point) ScalarMult(x *Scalar, q *Point) *Point

ScalarMult sets v = x * q, and returns v.

func (*Point) Select

func (v *Point) Select(p, q *Point, cond int) *Point

func (*Point) Set

func (v *Point) Set(u *Point) *Point

Set sets v = u, and returns v.

func (*Point) SetBytes

func (v *Point) SetBytes(data []byte) (*Point, error)

func (*Point) Sub

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

func (*Point) VarTimeDoubleScalarBaseMult

func (v *Point) VarTimeDoubleScalarBaseMult(a *Scalar, A *Point, b *Scalar) *Point

VarTimeDoubleScalarBaseMult sets v = a * A + b * B, where B is the canonical generator, and returns v.

Execution time depends on the inputs.

func (*Point) Zero

func (v *Point) Zero() *Point

type Scalar

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

A Scalar is an integer modulo

l = 2^446 - 13818066809895115352007386748515426880336692474882178609894547503885

which is the prime order of the edwards25519 group.

This type works similarly to math/big.Int, and all arguments and receivers are allowed to alias.

The zero value is a valid zero element.

func NewScalar

func NewScalar() *Scalar

func (*Scalar) Add

func (s *Scalar) Add(x, y *Scalar) *Scalar

func (*Scalar) Bytes

func (s *Scalar) Bytes() [56]byte

func (*Scalar) Equal

func (s *Scalar) Equal(t *Scalar) int

Equal returns 1 if s and t are equal, and 0 otherwise.

func (*Scalar) Mul

func (s *Scalar) Mul(x, y *Scalar) *Scalar

func (*Scalar) MulAdd

func (s *Scalar) MulAdd(x, y, z *Scalar) *Scalar

func (*Scalar) Negate

func (s *Scalar) Negate(x *Scalar) *Scalar

func (*Scalar) Set

func (s *Scalar) Set(x *Scalar) *Scalar

func (*Scalar) SetBytesWithClamping

func (s *Scalar) SetBytesWithClamping(x []byte) (*Scalar, error)

SetBytesWithClamping applies the buffer pruning described in RFC 8032, Section 5.2.5 (also known as clamping) and sets s to the result. The input must be 57 bytes, and it is not modified. If x is not of the right length, SetBytesWithClamping returns nil and an error, and the receiver is unchanged.

func (*Scalar) SetCanonicalBytes

func (s *Scalar) SetCanonicalBytes(x []byte) (*Scalar, error)

SetCanonicalBytes sets s = x, where x is a 57-byte little-endian encoding of s, and returns s. If x is not a canonical encoding of s, SetCanonicalBytes returns nil and an error, and the receiver is unchanged.

func (*Scalar) SetUniformBytes

func (s *Scalar) SetUniformBytes(x []byte) (*Scalar, error)

SetUniformBytes sets s = x mod l, where x is a 114-byte little-endian integer. If x is not of the right length, SetUniformBytes returns nil and an error, and the receiver is unchanged.

SetUniformBytes can be used to set s to an uniformly distributed value given 64 uniformly distributed random bytes.

func (*Scalar) Sub

func (s *Scalar) Sub(x, y *Scalar) *Scalar

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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