edwards25519

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package edwards25519 wraps filippo.io/edwards25519 and exposes a simple prime-order group API with hash-to-curve.

Package edwards25519 wraps filippo.io/edwards25519 and exposes a simple prime-order group API with hash-to-curve.

Package edwards25519 wraps filippo.io/edwards25519 and exposes a simple prime-order group API with hash-to-curve.

Index

Constants

View Source
const H2C = "edwards25519_XMD:SHA-512_ELL2_RO_"

H2C represents the hash-to-curve string identifier.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

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

Element represents an Edwards25519 point. It wraps an Edwards25519 implementation to leverage its optimized operations.

func (*Element) Add

func (e *Element) Add(element internal.Point) internal.Point

Add returns the sum of the Elements, and does not change the receiver.

func (*Element) Bytes

func (e *Element) Bytes() []byte

Bytes returns the compressed byte encoding of the element.

func (*Element) BytesMontgomery

func (e *Element) BytesMontgomery() []byte

BytesMontgomery returns the bi-rationally equivalent Curve25519 encoded point.

func (*Element) Copy

func (e *Element) Copy() internal.Point

Copy returns a copy of the element.

func (*Element) Decode

func (e *Element) Decode(in []byte) (internal.Point, error)

Decode decodes the input an sets the current element to its value, and returns it.

func (*Element) InvertMult

func (e *Element) InvertMult(scalar internal.Scalar) internal.Point

InvertMult returns the scalar multiplication of the receiver element with the inverse of the given scalar.

func (*Element) IsIdentity

func (e *Element) IsIdentity() bool

IsIdentity returns whether the element is the Group's identity element.

func (*Element) Mult

func (e *Element) Mult(scalar internal.Scalar) internal.Point

Mult returns the scalar multiplication of the receiver element with the given scalar.

func (*Element) Sub

func (e *Element) Sub(element internal.Point) internal.Point

Sub returns the difference between the Elements, and does not change the receiver.

type Group

type Group struct{}

Group represents the Edwards25519 group. It exposes a prime-order group API with hash-to-curve operations.

func (Group) Base

func (g Group) Base() internal.Point

Base returns group's base point a.k.a. canonical generator.

func (Group) ElementLength

func (g Group) ElementLength() int

ElementLength returns the byte size of an encoded element.

func (Group) HashToGroup

func (g Group) HashToGroup(input, dst []byte) internal.Point

HashToGroup allows arbitrary input to be safely mapped to the curve of the group.

func (Group) HashToScalar

func (g Group) HashToScalar(input, dst []byte) internal.Scalar

HashToScalar allows arbitrary input to be safely mapped to the field.

func (Group) Identity

func (g Group) Identity() internal.Point

Identity returns the group's identity element.

func (Group) MultBytes

func (g Group) MultBytes(s, e0 []byte) (internal.Point, error)

MultBytes allows []byte encodings of a scalar and an element of the group to be multiplied.

func (Group) NewElement

func (g Group) NewElement() internal.Point

NewElement returns a new, empty, element.

func (Group) NewScalar

func (g Group) NewScalar() internal.Scalar

NewScalar returns a new, empty, scalar.

type Scalar

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

Scalar represents an Edwards25519 scalar. It wraps an Edwards25519 implementation to leverage its optimized operations.

func (*Scalar) Add

func (s *Scalar) Add(scalar internal.Scalar) internal.Scalar

Add returns the sum of the scalars, and does not change the receiver.

func (*Scalar) Bytes

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

Bytes returns the byte encoding of the element.

func (*Scalar) Copy

func (s *Scalar) Copy() internal.Scalar

Copy returns a copy of the Scalar.

func (*Scalar) Decode

func (s *Scalar) Decode(in []byte) (internal.Scalar, error)

Decode decodes the input an sets the current scalar to its value, and returns it.

func (*Scalar) Invert

func (s *Scalar) Invert() internal.Scalar

Invert returns the scalar's modular inverse ( 1 / scalar ), and does not change the receiver.

func (*Scalar) Mult

func (s *Scalar) Mult(scalar internal.Scalar) internal.Scalar

Mult returns the multiplication of the scalars, and does not change the receiver.

func (*Scalar) Random

func (s *Scalar) Random() internal.Scalar

Random sets the current scalar to a new random scalar and returns it.

func (*Scalar) Sub

func (s *Scalar) Sub(scalar internal.Scalar) internal.Scalar

Sub returns the difference between the scalars, and does not change the receiver.

Jump to

Keyboard shortcuts

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