Overview
Package elliptic implements several standard elliptic curves over prime fields.
func GenerateKey
GenerateKey returns a public/private key pair. The private key is generated
using the given reader, which must return random data.
Marshal converts a point into the uncompressed form specified in section 4.3.6
of ANSI X9.62.
func Unmarshal
Unmarshal converts a point, serialized by Marshal, into an x, y pair. It is an
error if the point is not in uncompressed form or is not on the curve. On error,
x = nil.
- type Curve interface {
- // Params returns the parameters for the curve.
- Params() *CurveParams
- // IsOnCurve reports whether the given (x,y) lies on the curve.
- IsOnCurve(x, y *.Int)
- // Add returns the sum of (x1,y1) and (x2,y2)
- Add(x1, y1, x2, y2 *big.) (x, y *big.)
- // Double returns 2*(x,y)
- Double(x1, y1 *big.) (x, y *big.)
- // ScalarMult returns k*(Bx,By) where k is a number in big-endian form.
- ScalarMult(x1, y1 *big., k []byte) (x, y *.Int)
- // ScalarBaseMult returns k*G, where G is the base point of the group
- // and k is an integer in big-endian form.
- }
func
¶
- func P224()
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
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.
- func P384() Curve
P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4)
The cryptographic operations do not use constant-time algorithms.
func
¶
- func P521()
The cryptographic operations do not use constant-time algorithms.
type CurveParams
CurveParams contains the parameters of an elliptic curve and also provides a
generic, non-constant time implementation of Curve.
func (*CurveParams) Add
- func (curve *CurveParams) Add(x1, y1, x2, y2 *.Int) (*.Int, *.Int)
func (*CurveParams)
¶
func (*CurveParams)
¶
- func (curve *) Params() *CurveParams