Documentation ¶
Index ¶
- type SIEC255Params
- func (curve *SIEC255Params) Add(x1, y1, x2, y2 *big.Int) (x3, y3 *big.Int)
- func (curve *SIEC255Params) Compress(x, y *big.Int) (c [32]byte)
- func (curve *SIEC255Params) Decompress(c [32]byte) (x, y *big.Int)
- func (curve *SIEC255Params) Double(x1, y1 *big.Int) (x3, y3 *big.Int)
- func (curve *SIEC255Params) GenerateKey(rand io.Reader) (k []byte, x, y *big.Int, err error)
- func (curve *SIEC255Params) IsOnCurve(x, y *big.Int) bool
- func (curve *SIEC255Params) Params() *SIEC255Params
- func (curve *SIEC255Params) ScalarBaseMult(k []byte) (x, y *big.Int)
- func (curve *SIEC255Params) ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SIEC255Params ¶
type SIEC255Params struct { P *big.Int // the order of the underlying field N *big.Int // the order of the base point A *big.Int // the other constant of the curve equation B *big.Int // the constant of the curve equation Gx, Gy *big.Int // (x,y) of the base point BitSize int // the size of the underlying field Name string // the canonical name of the curve }
SIEC255Params contains the parameters of an elliptic curve and also provides a generic, non-constant time implementation of Curve.
func (*SIEC255Params) Add ¶
func (curve *SIEC255Params) Add(x1, y1, x2, y2 *big.Int) (x3, y3 *big.Int)
Add returns the sum of (x1,y1) and (x2,y2)
func (*SIEC255Params) Compress ¶
func (curve *SIEC255Params) Compress(x, y *big.Int) (c [32]byte)
Compress compresses a point down to 32 bytes. The first 31 bytes (index 0,1,2, and most of 3) represent the x coordinate (little endian). The last bit of the fourth byte is the parity of the y coordinate.
func (*SIEC255Params) Decompress ¶
func (curve *SIEC255Params) Decompress(c [32]byte) (x, y *big.Int)
Decompress uncompresses a point and returns an actual (x,y) pair.
func (*SIEC255Params) Double ¶
func (curve *SIEC255Params) Double(x1, y1 *big.Int) (x3, y3 *big.Int)
Double returns 2*(x,y)
func (*SIEC255Params) GenerateKey ¶
GenerateKey returns a public/private key pair. The private key is generated using the given reader, which must return random data. This is copied from https://golang.org/src/crypto/elliptic/elliptic.go?s=7368:7453#L266
func (*SIEC255Params) IsOnCurve ¶
func (curve *SIEC255Params) IsOnCurve(x, y *big.Int) bool
IsOnCurve reports whether the given (x,y) lies on the curve.
func (*SIEC255Params) Params ¶
func (curve *SIEC255Params) Params() *SIEC255Params
Params returns the parameters for the curve.
func (*SIEC255Params) ScalarBaseMult ¶
func (curve *SIEC255Params) ScalarBaseMult(k []byte) (x, y *big.Int)
ScalarBaseMult returns k*G, where G is the base point of the group and k is an integer in big-endian form.
func (*SIEC255Params) ScalarMult ¶
ScalarMult returns k*(Bx,By) where k is a number in big-endian form.