secp256k1

package
v0.0.0-...-a58a8a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EllipticCurve

type EllipticCurve struct {
	A *big.Int
	B *big.Int
	P *big.Int
	G Point
	N *big.Int
	H *big.Int
}

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 Point

type Point struct {
	X *big.Int
	Y *big.Int
}

Point represents a point on an EllipticCurve.

func (Point) Compression

func (p Point) Compression() (b []byte)

Compression Compression

type PrivateKey

type PrivateKey struct {
	PublicKey
	D *big.Int
}

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

func (pub *PublicKey) BytesToHex() string

BytesToHex convert bytes to hex

func (*PublicKey) ToAddress

func (pub *PublicKey) ToAddress(alphabet *base58.Alphabet, accountPrefix uint8) (address string)

ToAddress convert public key to address with alphabet & account prefix

func (*PublicKey) ToBytes

func (pub *PublicKey) ToBytes() (b []byte)

ToBytes convert to 33 bytes public key

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

func (*Secp256KeyPair) GenerateSeed(alphabet *base58.Alphabet, seedfix uint8) (string, error)

GenerateSeed generate secret with alphabet & seedfix

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL