Documentation
¶
Index ¶
- type EllipticCurve
- type Point
- type PrivateKey
- type PublicKey
- type Secp256KeyPair
- func (*Secp256KeyPair) CheckAddress(address string, alphabet *base58.Alphabet, accountPrefix uint8) bool
- func (*Secp256KeyPair) DeriveKeyPair(secret string, alphabet *base58.Alphabet, seedfix uint8) (*PrivateKey, error)
- func (*Secp256KeyPair) GenerateSeed(alphabet *base58.Alphabet, seedfix uint8) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EllipticCurve ¶
EllipticCurve y**2 = x**3 + a*x + b % p EllipticCurve represents the parameters of a short Weierstrass equation elliptic curve.
func (*EllipticCurve) Add ¶
func (ec *EllipticCurve) Add(P, Q Point) (R Point)
Add computes R = P + Q on EllipticCurve ec.
func (*EllipticCurve) IsInfinity ¶
func (ec *EllipticCurve) IsInfinity(P Point) bool
IsInfinity checks if point P is infinity on EllipticCurve ec.
func (*EllipticCurve) IsOnCurve ¶
func (ec *EllipticCurve) IsOnCurve(P Point) bool
IsOnCurve checks if point P is on EllipticCurve ec.
func (*EllipticCurve) ScalarBaseMult ¶
func (ec *EllipticCurve) ScalarBaseMult(k *big.Int) (Q Point)
ScalarBaseMult computes Q = k * G on EllipticCurve ec.
func (*EllipticCurve) ScalarMult ¶
func (ec *EllipticCurve) ScalarMult(k *big.Int, P Point) (Q Point)
ScalarMult computes Q = k * P on EllipticCurve ec.
type PrivateKey ¶
PrivateKey represents a Bitcoin private key.
func (*PrivateKey) ToBytes ¶
func (priv *PrivateKey) ToBytes() (b []byte)
ToBytes convert private key to 32 bytes
type PublicKey ¶
type PublicKey struct {
Point
}
PublicKey represents a Bitcoin public key.
func (*PublicKey) BytesToHex ¶
BytesToHex convert bytes to hex
type Secp256KeyPair ¶
type Secp256KeyPair struct{}
Secp256KeyPair strcut
func (*Secp256KeyPair) CheckAddress ¶
func (*Secp256KeyPair) CheckAddress(address string, alphabet *base58.Alphabet, accountPrefix uint8) bool
CheckAddress validate address is valid or not with alphabet & account prefix
func (*Secp256KeyPair) DeriveKeyPair ¶
func (*Secp256KeyPair) DeriveKeyPair(secret string, alphabet *base58.Alphabet, seedfix uint8) (*PrivateKey, error)
DeriveKeyPair derive keypair by secret with alphabet and seedfix
func (*Secp256KeyPair) GenerateSeed ¶
GenerateSeed generate secret with alphabet & seedfix