Documentation ¶
Index ¶
- type Base58
- type EllipticCurve
- func (e *EllipticCurve) Add(P, Q EllipticCurvePoint) (*EllipticCurvePoint, error)
- func (e *EllipticCurve) IsOnCurve(point EllipticCurvePoint) bool
- func (e *EllipticCurve) ScalarBaseMult(k *big.Int) (*EllipticCurvePoint, error)
- func (e *EllipticCurve) ScalarMult(k *big.Int, P EllipticCurvePoint) (*EllipticCurvePoint, error)
- type EllipticCurvePoint
- type ModularArithmetic
- func (m ModularArithmetic) Add(x *big.Int, y *big.Int, p *big.Int) *big.Int
- func (m ModularArithmetic) Exp(x *big.Int, y *big.Int, p *big.Int) *big.Int
- func (m ModularArithmetic) Inverse(x *big.Int, p *big.Int) *big.Int
- func (m ModularArithmetic) Mul(x *big.Int, y *big.Int, p *big.Int) *big.Int
- func (m ModularArithmetic) Sqrt(x *big.Int, p *big.Int) (*big.Int, error)
- func (m ModularArithmetic) Sub(x *big.Int, y *big.Int, p *big.Int) *big.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base58 ¶
type Base58 struct {
// contains filtered or unexported fields
}
Base58 is a encode/decode utility for base58 strings.
func NewBase58 ¶
func NewBase58() Base58
NewBase58 creates a new Base58 struct, using the default alphabet.
type EllipticCurve ¶
type EllipticCurve struct { A *big.Int B *big.Int P *big.Int G EllipticCurvePoint N *big.Int H *big.Int // contains filtered or unexported fields }
EllipticCurve represents the parameters of a short Weierstrass equation elliptic curve.
func NewEllipticCurve ¶
func NewEllipticCurve() EllipticCurve
NewEllipticCurve creates a new EllipticCurve struct.
func (*EllipticCurve) Add ¶
func (e *EllipticCurve) Add(P, Q EllipticCurvePoint) (*EllipticCurvePoint, error)
Add computes R = P + Q on EllipticCurve ec.
func (*EllipticCurve) IsOnCurve ¶
func (e *EllipticCurve) IsOnCurve(point EllipticCurvePoint) bool
IsOnCurve checks if point P is on EllipticCurve ec.
func (*EllipticCurve) ScalarBaseMult ¶
func (e *EllipticCurve) ScalarBaseMult(k *big.Int) (*EllipticCurvePoint, error)
ScalarBaseMult computes Q = k * G on EllipticCurve ec.
func (*EllipticCurve) ScalarMult ¶
func (e *EllipticCurve) ScalarMult(k *big.Int, P EllipticCurvePoint) (*EllipticCurvePoint, error)
ScalarMult computes Q = k * P on EllipticCurve ec.
type EllipticCurvePoint ¶
EllipticCurvePoint represents a point on an elliptic curve.
func (EllipticCurvePoint) Format ¶
func (p EllipticCurvePoint) Format() string
Format encodes the bytes of an EllipticCurvePoint for debugging.
type ModularArithmetic ¶
type ModularArithmetic struct{}
ModularArithmetic is a set of helper functions for carrying out specialised mathematical operations in an elliptic curve.
func NewModularArithmetic ¶
func NewModularArithmetic() ModularArithmetic
NewModularArithmetic creates a new ModularArithmetic struct.