Documentation ¶
Overview ¶
Package bitelliptic implements several Koblitz elliptic curves over prime fields.
Package bitelliptic implements several Koblitz elliptic curves over prime fields.
Index ¶
- Variables
- type BitCurve
- func (bitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)
- func (bitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)
- func (bitCurve *BitCurve) GenerateKey(rand io.Reader) (priv []byte, x, y *big.Int, err error)
- func (bitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool
- func (bitCurve *BitCurve) Marshal(x, y *big.Int) []byte
- func (bitCurve *BitCurve) Params() (cp *elliptic.CurveParams)
- func (bitCurve *BitCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)
- func (bitCurve *BitCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)
- func (bitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int)
Constants ¶
This section is empty.
Variables ¶
var ( OIDNamedCurveSecp160k1 = asn1.ObjectIdentifier{1, 3, 132, 0, 9} OIDNamedCurveSecp192k1 = asn1.ObjectIdentifier{1, 3, 132, 0, 31} OIDNamedCurveSecp224k1 = asn1.ObjectIdentifier{1, 3, 132, 0, 32} OIDNamedCurveSecp256k1 = asn1.ObjectIdentifier{1, 3, 132, 0, 10} )
Functions ¶
This section is empty.
Types ¶
type BitCurve ¶
type BitCurve struct { Name string P *big.Int // the order of the underlying field N *big.Int // the order of the base point B *big.Int // the constant of the BitCurve equation Gx, Gy *big.Int // (x,y) of the base point BitSize int // the size of the underlying field }
A BitCurve represents a Koblitz Curve with a=0. See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
func S160 ¶
func S160() *BitCurve
S160 returns a BitCurve which implements secp160k1 (see SEC 2 section 2.4.1)
func S192 ¶
func S192() *BitCurve
S192 returns a BitCurve which implements secp192k1 (see SEC 2 section 2.5.1)
func S224 ¶
func S224() *BitCurve
S224 returns a BitCurve which implements secp224k1 (see SEC 2 section 2.6.1)
func S256 ¶
func S256() *BitCurve
S256 returns a BitCurve which implements bitcurves (see SEC 2 section 2.7.1)
func (*BitCurve) GenerateKey ¶
TODO: double check if it is okay GenerateKey returns a public/private key pair. The private key is generated using the given reader, which must return random data.
func (*BitCurve) Marshal ¶
Marshal converts a point into the form specified in section 4.3.6 of ANSI X9.62.
func (*BitCurve) Params ¶
func (bitCurve *BitCurve) Params() (cp *elliptic.CurveParams)
Params returns the parameters of the given BitCurve (see BitCurve struct)
func (*BitCurve) ScalarBaseMult ¶
ScalarBaseMult returns k*G, where G is the base point of the group and k is an integer in big-endian form.
func (*BitCurve) ScalarMult ¶
ScalarMult returns k*(Bx,By) where k is a number in big-endian form.