scalar

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 scalar implements the ristretto255 scalar group.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scalar

type Scalar [32]byte

A Scalar is an integer modulo l = 2^252 + 27742317777372353535851937790883648493, here represented as an opaque little-endian byte string.

func (*Scalar) Add

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

Add sets s = x + y mod l and returns s.

func (*Scalar) Bytes

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

Bytes appends a 32 bytes little-endian encoding of s to b.

func (*Scalar) Equal

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

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

func (*Scalar) FromCanonicalBytes

func (s *Scalar) FromCanonicalBytes(x []byte) error

FromCanonicalBytes sets s = x, where x is a 32 bytes little-endian encoding of s. If x is not a canonical encoding of s, FromCanonicalBytes returns an error and the receiver is unchanged.

func (*Scalar) FromUniformBytes

func (s *Scalar) FromUniformBytes(x []byte) *Scalar

FromUniformBytes sets s to an uniformly distributed value given 64 uniformly distributed random bytes.

func (*Scalar) Inv

func (s *Scalar) Inv(t *Scalar) *Scalar

Inv sets s to the inverse of a nonzero scalar v and returns s.

func (*Scalar) Mul

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

Mul sets s = x * y mod l and returns s.

func (*Scalar) Neg

func (s *Scalar) Neg(x *Scalar) *Scalar

Neg sets s = -x mod l and returns s.

func (*Scalar) NonAdjacentForm

func (s *Scalar) NonAdjacentForm(w uint) [256]int8

NonAdjacentForm computes a width-w non-adjacent form for this scalar.

func (*Scalar) SignedRadix16

func (s *Scalar) SignedRadix16() [64]int8

func (*Scalar) Sub

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

Sub sets s = x - y mod l and returns s.

Jump to

Keyboard shortcuts

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