Documentation ¶
Overview ¶
Package address provides ...
Package ec provides ...
Package ec provides ...
Index ¶
- Constants
- func PrivKeyFromBytes(bytes []byte) (*PrivateKey, *PublicKey)
- type AddressPubKeyHash
- type KoblitzCurve
- func (curve *KoblitzCurve) Add(x1 *big.Int, y1 *big.Int, x2 *big.Int, y2 *big.Int) (x *big.Int, y *big.Int)
- func (curve *KoblitzCurve) Double(x1 *big.Int, y1 *big.Int) (x *big.Int, y *big.Int)
- func (curve *KoblitzCurve) IsOnCurve(x *big.Int, y *big.Int) bool
- func (curve *KoblitzCurve) Params() *elliptic.CurveParams
- func (curve *KoblitzCurve) QPlus1Div4() *big.Int
- func (curve *KoblitzCurve) ScalarBaseMult(k []byte) (x *big.Int, y *big.Int)
- func (curve *KoblitzCurve) ScalarMult(x1 *big.Int, y1 *big.Int, k []byte) (*big.Int, *big.Int)
- type PrivateKey
- type PublicKey
Constants ¶
const ( PubKeyBytesLenCompressed = 33 PubKeyBytesLenUncompressed = 65 PubKeyBytesLenHybrid = 65 )
const PrivKeyBytesLen = 32
Variables ¶
This section is empty.
Functions ¶
func PrivKeyFromBytes ¶
func PrivKeyFromBytes(bytes []byte) (*PrivateKey, *PublicKey)
Types ¶
type AddressPubKeyHash ¶
type AddressPubKeyHash struct {
// contains filtered or unexported fields
}
AddressPubKeyHash pay-to-pubkey-hash (P2PKH)
func NewAddressPubKeyHash ¶
func NewAddressPubKeyHash(pkHash []byte, version byte) (*AddressPubKeyHash, error)
func (*AddressPubKeyHash) EncodeAddress ¶
func (a *AddressPubKeyHash) EncodeAddress() string
EncodeAddress return P2PKH address
func (*AddressPubKeyHash) Hash160 ¶
func (a *AddressPubKeyHash) Hash160() []byte
Hash160 return hash160
type KoblitzCurve ¶
type KoblitzCurve struct { *elliptic.CurveParams // contains filtered or unexported fields }
KoblitzCurve A Koblitz Curve with a=0.
func (*KoblitzCurve) Add ¶
func (curve *KoblitzCurve) Add(x1 *big.Int, y1 *big.Int, x2 *big.Int, y2 *big.Int) (x *big.Int, y *big.Int)
Add returns the sum of (x1,y1) and (x2,y2)
func (*KoblitzCurve) Params ¶
func (curve *KoblitzCurve) Params() *elliptic.CurveParams
Params returns the parameters for the curve
func (*KoblitzCurve) QPlus1Div4 ¶
func (curve *KoblitzCurve) QPlus1Div4() *big.Int
QPlus1Div4 returns the Q+1/4 constant for the curve for use in calculating square roots via exponention.
func (*KoblitzCurve) ScalarBaseMult ¶
ScalarBaseMult returns k*G, where G is the base point of the group and k is an integer in big-endian form.
type PrivateKey ¶
func (*PrivateKey) Serialize ¶
func (privKey *PrivateKey) Serialize() []byte
type PublicKey ¶
PublicKey struct
func ParsePubKey ¶
ParsePubKey parses a public key for a koblitz curve from a bytestring into a ecdsa.Publickey, verifying that it is valid. It supports compressed, uncompressed and hybrid signature formats.
func (*PublicKey) SerializeCompressed ¶
SerializeCompressed serializes a public key 33-byte compressed format