Documentation ¶
Index ¶
- type Point
- func (v *Point) Add(p, q *Point) *Point
- func (v *Point) Bytes() []byte
- func (v *Point) CondNeg(cond int) *Point
- func (v *Point) Double(u *Point) *Point
- func (v *Point) Equal(u *Point) int
- func (v *Point) Negate(p *Point) *Point
- func (v *Point) ScalarBaseMult(x *Scalar) *Point
- func (v *Point) ScalarMult(x *Scalar, q *Point) *Point
- func (v *Point) Select(p, q *Point, cond int) *Point
- func (v *Point) Set(u *Point) *Point
- func (v *Point) SetBytes(data []byte) (*Point, error)
- func (v *Point) Sub(p, q *Point) *Point
- func (v *Point) VarTimeDoubleScalarBaseMult(a *Scalar, A *Point, b *Scalar) *Point
- func (v *Point) Zero() *Point
- type Scalar
- func (s *Scalar) Add(x, y *Scalar) *Scalar
- func (s *Scalar) Bytes() [56]byte
- func (s *Scalar) Equal(t *Scalar) int
- func (s *Scalar) Mul(x, y *Scalar) *Scalar
- func (s *Scalar) MulAdd(x, y, z *Scalar) *Scalar
- func (s *Scalar) Negate(x *Scalar) *Scalar
- func (s *Scalar) Set(x *Scalar) *Scalar
- func (s *Scalar) SetBytesWithClamping(x []byte) (*Scalar, error)
- func (s *Scalar) SetCanonicalBytes(x []byte) (*Scalar, error)
- func (s *Scalar) SetUniformBytes(x []byte) (*Scalar, error)
- func (s *Scalar) Sub(x, y *Scalar) *Scalar
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) Bytes ¶
Bytes returns the canonical 57-byte encoding of v, according to RFC 8032, Section 5.2.2.
func (*Point) ScalarBaseMult ¶
ScalarBaseMult sets v = x * B, where B is the canonical generator, and returns v.
func (*Point) ScalarMult ¶
ScalarMult sets v = x * q, and returns v.
func (*Point) VarTimeDoubleScalarBaseMult ¶
VarTimeDoubleScalarBaseMult sets v = a * A + b * B, where B is the canonical generator, and returns v.
Execution time depends on the inputs.
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 (*Scalar) SetBytesWithClamping ¶
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 ¶
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 ¶
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.