Documentation ¶
Index ¶
- Variables
- type Point
- func (z *Point) Add(x, y *Point) *Point
- func (p *Point) Bytes() []byte
- func (z *Point) ConstTimeEqual(x *Point) bool
- func (z *Point) Decode(e [32]byte) (*Point, bool)
- func (z *Point) Encode() [32]byte
- func (p *Point) MarshalBinary() ([]byte, error)
- func (p *Point) MarshalText() ([]byte, error)
- func (p *Point) ReadFrom(r io.Reader) (n int64, err error)
- func (z *Point) ScMul(x *Point, y *Scalar) *Point
- func (z *Point) ScMulAdd(a *Point, x, y *Scalar) *Point
- func (z *Point) ScMulBase(x *Scalar) *Point
- func (z *Point) ScMulCofactor(p *Point) *Point
- func (p *Point) String() string
- func (z *Point) Sub(x, y *Point) *Point
- func (p *Point) UnmarshalBinary(data []byte) error
- func (p *Point) UnmarshalText(b []byte) error
- func (p *Point) WriteTo(w io.Writer) (n int64, err error)
- type Scalar
- func (z *Scalar) Add(x, y *Scalar) *Scalar
- func (z *Scalar) Equal(x *Scalar) bool
- func (z *Scalar) Mul(x, y *Scalar) *Scalar
- func (z *Scalar) MulAdd(a, b, c *Scalar) *Scalar
- func (z *Scalar) Neg(x *Scalar) *Scalar
- func (z *Scalar) Prune()
- func (z *Scalar) Reduce(x *[64]byte) *Scalar
- func (s *Scalar) SetInt64(n int64) *Scalar
- func (s *Scalar) SetUint64(n uint64) *Scalar
- func (s *Scalar) String() string
- func (z *Scalar) Sub(x, y *Scalar) *Scalar
Constants ¶
This section is empty.
Variables ¶
var ( // Zero is the number 0. Zero Scalar // One is the number 1. One = Scalar{1} Cofactor = Scalar{8} // NegOne is the number -1 mod L NegOne = Scalar{ 0xec, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } // L is the subgroup order: // 2^252 + 27742317777372353535851937790883648493 L = Scalar{ 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, } )
Functions ¶
This section is empty.
Types ¶
type Point ¶
type Point edwards25519.ExtendedGroupElement
Point is a point on the ed25519 curve.
var ZeroPoint Point
ZeroPoint is the zero point on the ed25519 curve (not the zero value of Point).
func (*Point) Add ¶
Add adds the points in x and y, storing the result in z and returning that. Any or all of x, y, and z may be the same pointers.
func (*Point) ConstTimeEqual ¶
func (*Point) MarshalBinary ¶
MarshalBinary encodes the receiver into a binary form and returns the result (32-byte slice).
func (*Point) MarshalText ¶
MarshalText returns a hex-encoded point.
func (*Point) ScMul ¶
ScMul multiplies the EC point x by the scalar y, placing the result in z and returning that. X and z may be the same pointer.
func (*Point) ScMulAdd ¶
ScMulAdd computes xa+yB, where B is the ed25519 base point, and places the result in z, returning that.
func (*Point) ScMulBase ¶
ScMulBase multiplies the ed25519 base point by x and places the result in z, returning that.
func (*Point) ScMulCofactor ¶
ScMulCofactor computes 8*p, where p is the ed25519 point and 8 is a cofactor, and places the result in z, returning that.
func (*Point) Sub ¶
Sub subtracts y from x, storing the result in z and returning that. Any or all of x, y, and z may be the same pointers.
func (*Point) UnmarshalBinary ¶
UnmarshalBinary decodes point for a given slice. Returns error if the slice is not 32-bytes long or the encoding is invalid.
func (*Point) UnmarshalText ¶
UnmarshalText decodes a point from a hex-encoded buffer.
type Scalar ¶
type Scalar [32]byte
Scalar is a 256-bit little-endian scalar.
func (*Scalar) Add ¶
Add computes x+y (mod L) and places the result in z, returning that. Any or all of x, y, and z may be the same pointer.
func (*Scalar) Mul ¶
Mul computes x*y (mod L) and places the result in z, returning that. Any or all of x, y, and z may be the same pointer.
func (*Scalar) MulAdd ¶
MulAdd computes ab+c (mod L) and places the result in z, returning that. Any or all of the pointers may be the same.
func (*Scalar) Neg ¶
Neg negates x (mod L) and places the result in z, returning that. X and z may be the same pointer.
func (*Scalar) Reduce ¶
Reduce takes a 512-bit scalar and reduces it mod L, placing the result in z and returning that.