Documentation ¶
Overview ¶
Package ristretto allows simple and abstracted operations in the Ristretto255 group
Package ristretto wraps "github.com/gtank/ristretto255" and exposes a simple prime-order group API with hash-to-curve.
Package ristretto allows simple and abstracted operations in the Ristretto255 group
Index ¶
- Constants
- type Group
- func (r Group) Base() internal.Point
- func (r Group) ElementLength() int
- func (r Group) HashToGroup(input, dst []byte) internal.Point
- func (r Group) HashToScalar(input, dst []byte) internal.Scalar
- func (r Group) Identity() internal.Point
- func (r Group) MultBytes(s, e []byte) (internal.Point, error)
- func (r Group) NewElement() internal.Point
- func (r Group) NewScalar() internal.Scalar
- type Point
- func (p *Point) Add(element internal.Point) internal.Point
- func (p *Point) Base() internal.Point
- func (p *Point) Bytes() []byte
- func (p *Point) Copy() internal.Point
- func (p *Point) Decode(in []byte) (internal.Point, error)
- func (p *Point) InvertMult(scalar internal.Scalar) internal.Point
- func (p *Point) IsIdentity() bool
- func (p *Point) Mult(scalar internal.Scalar) internal.Point
- func (p *Point) Sub(element internal.Point) internal.Point
- type Scalar
- func (s *Scalar) Add(scalar internal.Scalar) internal.Scalar
- func (s *Scalar) Bytes() []byte
- func (s *Scalar) Copy() internal.Scalar
- func (s *Scalar) Decode(in []byte) (internal.Scalar, error)
- func (s *Scalar) Invert() internal.Scalar
- func (s *Scalar) Mult(scalar internal.Scalar) internal.Scalar
- func (s *Scalar) Random() internal.Scalar
- func (s *Scalar) Sub(scalar internal.Scalar) internal.Scalar
Constants ¶
const (
// H2C represents the hash-to-curve string identifier.
H2C = "ristretto255_XMD:SHA-512_R255MAP_RO_"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct{}
Group represents the Ristretto255 group. It exposes a prime-order group API with hash-to-curve operations.
func (Group) ElementLength ¶
ElementLength returns the byte size of an encoded element.
func (Group) HashToGroup ¶
HashToGroup allows arbitrary input to be safely mapped to the curve of the group.
func (Group) HashToScalar ¶
HashToScalar allows arbitrary input to be safely mapped to the field.
func (Group) MultBytes ¶
MultBytes allows []byte encodings of a scalar and an element of the group to be multiplied.
func (Group) NewElement ¶
NewElement returns a new, empty, element.
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point implements the Point interface for the Ristretto255 group element.
func (*Point) Add ¶
Add adds the argument to the receiver, sets the receiver to the result and returns it.
func (*Point) Decode ¶
Decode decodes the input an sets the current element to its value, and returns it.
func (*Point) InvertMult ¶
InvertMult returns the scalar multiplication of the receiver element with the inverse of the given scalar.
func (*Point) IsIdentity ¶
IsIdentity returns whether the element is the group's identity element.
type Scalar ¶
type Scalar struct {
// contains filtered or unexported fields
}
Scalar implements the Scalar interface for Ristretto255 group scalars.
func (*Scalar) Decode ¶
Decode decodes the input an sets the current scalar to its value, and returns it.
func (*Scalar) Mult ¶
Mult returns the multiplication of the scalars, and does not change the receiver.