Documentation ¶
Overview ¶
Package ristretto255 implements the group of prime order
2**252 + 27742317777372353535851937790883648493
as specified in draft-hdevalence-cfrg-ristretto-01.
All operations are constant time unless otherwise specified.
Index ¶
- type Element
- func (e *Element) Add(p, q *Element) *Element
- func (e *Element) Base() *Element
- func (e *Element) Decode(in []byte) error
- func (e *Element) Encode(b []byte) []byte
- func (e *Element) Equal(ee *Element) int
- func (e *Element) FromUniformBytes(b []byte) *Element
- func (e *Element) MarshalText() (text []byte, err error)
- func (e *Element) MultiScalarMult(s []*Scalar, p []*Element) *Element
- func (e *Element) MultiScalarMult_GH(s []*Scalar, table []NafLookupTable8Pro) *Element
- func (e *Element) MultiScalarMult_opt(s []*Scalar, p []*Element) *Element
- func (e *Element) Negate(p *Element) *Element
- func (e *Element) ScalarBaseMult(s *Scalar) *Element
- func (e *Element) ScalarMult(s *Scalar, p *Element) *Element
- func (e *Element) ScalarMultWnaf(s *Scalar, p *Element) *Element
- func (e *Element) String() string
- func (e *Element) Subtract(p, q *Element) *Element
- func (e *Element) UnmarshalText(text []byte) error
- func (e *Element) VarTimeDoubleScalarBaseMult(a *Scalar, A *Element, b *Scalar) *Element
- func (e *Element) VarTimeMultiScalarMult(s []*Scalar, p []*Element) *Element
- func (e *Element) Zero() *Element
- type NafLookupTable8Pro
- type Scalar
- func (s *Scalar) Add(x, y *Scalar) *Scalar
- func (s *Scalar) Decode(x []byte) error
- func (s *Scalar) Encode(b []byte) []byte
- func (s *Scalar) Equal(u *Scalar) int
- func (s *Scalar) FromUniformBytes(x []byte) *Scalar
- func (s *Scalar) Invert(x *Scalar) *Scalar
- func (s *Scalar) MarshalText() (text []byte, err error)
- func (s *Scalar) Multiply(x, y *Scalar) *Scalar
- func (s *Scalar) Negate(x *Scalar) *Scalar
- func (s *Scalar) String() string
- func (s *Scalar) Subtract(x, y *Scalar) *Scalar
- func (s *Scalar) UnmarshalText(text []byte) error
- func (s *Scalar) Zero() *Scalar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element is an element of the ristretto255 prime-order group.
func NewElement ¶
func NewElement() *Element
NewElement returns a new Element set to the identity value.
func (*Element) Base ¶
Base sets e to the canonical generator specified in draft-hdevalence-cfrg-ristretto-01, Section 3, and returns e.
func (*Element) Decode ¶
Decode sets e to the decoded value of in. If in is not a 32 byte canonical encoding, Decode returns an error, and the receiver is unchanged.
func (*Element) Encode ¶
Encode appends the 32 bytes canonical encoding of e to b and returns the result.
func (*Element) Equal ¶
Equal returns 1 if e is equivalent to ee, and 0 otherwise.
Note that Elements must not be compared in any other way.
func (*Element) FromUniformBytes ¶
FromUniformBytes maps the 64-byte slice b to e uniformly and deterministically, and returns e. This can be used for hash-to-group operations or to obtain a random element.
func (*Element) MarshalText ¶
MarshalText implements encoding/TextMarshaler interface
func (*Element) MultiScalarMult ¶
MultiScalarMult sets e = sum(s[i] * p[i]), and returns e.
Execution time depends only on the lengths of the two slices, which must match.
func (*Element) MultiScalarMult_GH ¶
func (e *Element) MultiScalarMult_GH(s []*Scalar, table []NafLookupTable8Pro) *Element
func (*Element) MultiScalarMult_opt ¶
func (*Element) ScalarBaseMult ¶
ScalarBaseMult sets e = s * B, where B is the canonical generator, and returns e.
func (*Element) ScalarMult ¶
ScalarMult sets e = s * p, and returns e.
func (*Element) UnmarshalText ¶
UnmarshalText implements encoding/TextMarshaler interface
func (*Element) VarTimeDoubleScalarBaseMult ¶
VarTimeDoubleScalarBaseMult sets e = a * A + b * B, where B is the canonical generator, and returns e.
Execution time depends on the inputs.
func (*Element) VarTimeMultiScalarMult ¶
VarTimeMultiScalarMult sets e = sum(s[i] * p[i]), and returns e.
Execution time depends on the inputs.
type NafLookupTable8Pro ¶
type NafLookupTable8Pro struct {
// contains filtered or unexported fields
}
func GenGHtable ¶
func GenGHtable(points []*Element) []NafLookupTable8Pro
type Scalar ¶
type Scalar struct {
// contains filtered or unexported fields
}
A Scalar is an element of the ristretto255 scalar field, as specified in draft-hdevalence-cfrg-ristretto-01, Section 3.4. That is, an integer modulo
l = 2^252 + 27742317777372353535851937790883648493
func (*Scalar) Decode ¶
Decode sets s = x, where x is a 32 bytes little-endian encoding of s. If x is not a canonical encoding of s, Decode returns an error and the receiver is unchanged.
func (*Scalar) FromUniformBytes ¶
FromUniformBytes sets s to an uniformly distributed value given 64 uniformly distributed random bytes.
func (*Scalar) Invert ¶
Invert sets s = 1 / x such that s * x = 1 mod l and returns s.
If x is 0, the result is undefined.
func (*Scalar) MarshalText ¶
MarshalText implements encoding/TextMarshaler interface
func (*Scalar) UnmarshalText ¶
UnmarshalText implements encoding/TextMarshaler interface
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
edwards25519
Package edwards25519 implements group logic for the twisted Edwards curve -x^2 + y^2 = 1 + -(121665/121666)*x^2*y^2 This is better known as the Edwards curve equivalent to curve25519, and is the curve used by the Ed25519 signature scheme.
|
Package edwards25519 implements group logic for the twisted Edwards curve -x^2 + y^2 = 1 + -(121665/121666)*x^2*y^2 This is better known as the Edwards curve equivalent to curve25519, and is the curve used by the Ed25519 signature scheme. |
radix51
Package radix51 implements GF(2^255-19) field arithmetic in radix 2^51 representation.
|
Package radix51 implements GF(2^255-19) field arithmetic in radix 2^51 representation. |
scalar
Package scalar implements the ristretto255 scalar group.
|
Package scalar implements the ristretto255 scalar group. |