Documentation ¶
Index ¶
- func NAF(k []byte) ([]byte, []byte)
- func SECP256K1() elliptic.Curve
- type KoblitzCurve
- func (curve *KoblitzCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)
- func (curve *KoblitzCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)
- func (curve *KoblitzCurve) H() int
- func (curve *KoblitzCurve) IsOnCurve(x, y *big.Int) bool
- func (curve *KoblitzCurve) Params() *elliptic.CurveParams
- func (curve *KoblitzCurve) Q() *big.Int
- func (curve *KoblitzCurve) QPlus1Div4() *big.Int
- func (curve *KoblitzCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)
- func (curve *KoblitzCurve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NAF ¶
NAF takes a positive integer k and returns the Non-Adjacent Form (NAF) as two byte slices. The first is where 1s will be. The second is where -1s will be. NAF is convenient in that on average, only 1/3rd of its values are non-zero. This is algorithm 3.30 from [GECC].
Essentially, this makes it possible to minimize the number of operations since the resulting ints returned will be at least 50% 0s.
Types ¶
type KoblitzCurve ¶
type KoblitzCurve struct { *elliptic.CurveParams // contains filtered or unexported fields }
KoblitzCurve supports a koblitz curve implementation that fits the ECC Curve interface from crypto/elliptic.
func (*KoblitzCurve) Add ¶
Add returns the sum of (x1,y1) and (x2,y2). Part of the elliptic.Curve interface.
func (*KoblitzCurve) H ¶
func (curve *KoblitzCurve) H() int
func (*KoblitzCurve) IsOnCurve ¶
func (curve *KoblitzCurve) IsOnCurve(x, y *big.Int) bool
IsOnCurve returns boolean if the point (x,y) is on the curve. Part of the elliptic.Curve interface. This function differs from the crypto/elliptic algorithm since a = 0 not -3.
func (*KoblitzCurve) Params ¶
func (curve *KoblitzCurve) Params() *elliptic.CurveParams
Params returns the parameters for the curve.
func (*KoblitzCurve) Q ¶
func (curve *KoblitzCurve) Q() *big.Int
Q returns the (P+1)/4 constant for the curve for use in calculating square roots via exponentiation.
func (*KoblitzCurve) QPlus1Div4 ¶
func (curve *KoblitzCurve) QPlus1Div4() *big.Int
QPlus1Div4 returns the (P+1)/4 constant for the curve for use in calculating square roots via exponentiation.
DEPRECATED: The actual value returned is (P+1)/4, where as the original method name implies that this value is (((P+1)/4)+1)/4. This method is kept to maintain backwards compatibility of the API. Use Q() instead.
func (*KoblitzCurve) ScalarBaseMult ¶
ScalarBaseMult returns k*G where G is the base point of the group and k is a big endian integer. Part of the elliptic.Curve interface.
func (*KoblitzCurve) ScalarMult ¶
ScalarMult returns k*(Bx, By) where k is a big endian integer. Part of the elliptic.Curve interface.