Documentation
¶
Overview ¶
Package elliptic implements several standard elliptic curves over prime fields.
Index ¶
- func GenerateKey(curve Curve, rand io.Reader) (priv []byte, x, y *big.Int, err error)
- func Marshal(curve Curve, x, y *big.Int) []byte
- func Unmarshal(curve Curve, data []byte) (x, y *big.Int)
- type Curve
- type CurveParams
- func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)
- func (curve *CurveParams) Double(x1, y1 *big.Int) (*big.Int, *big.Int)
- func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool
- func (curve *CurveParams) Params() *CurveParams
- func (curve *CurveParams) ScalarBaseMult(k []byte) (*big.Int, *big.Int)
- func (curve *CurveParams) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey returns a public/private key pair. The private key is generated using the given reader, which must return random data.
Types ¶
type Curve ¶
type Curve interface { Params() *CurveParams IsOnCurve(x, y *big.Int) bool Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int) Double(x1, y1 *big.Int) (x, y *big.Int) ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int) ScalarBaseMult(k []byte) (x, y *big.Int) }
A Curve represents a short-form Weierstrass curve with a=-3. See https://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
func P224 ¶
func P224() Curve
P224 returns a Curve which implements P-224 (see FIPS 186-3, section D.2.2).
The cryptographic operations are implemented using constant-time algorithms.
func P256 ¶
func P256() Curve
P256 returns a Curve which implements P-256 (see FIPS 186-3, section D.2.3)
The cryptographic operations are implemented using constant-time algorithms.
type CurveParams ¶
type CurveParams struct { P *big.Int N *big.Int B *big.Int Gx, Gy *big.Int BitSize int Name string }
CurveParams contains the parameters of an elliptic curve and also provides a generic, non-constant time implementation of Curve.
func (*CurveParams) Params ¶
func (curve *CurveParams) Params() *CurveParams