crypto

package
v0.0.0-...-75fa6d2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverAddress

func RecoverAddress(sig []byte, msg []byte) (string, error)

secp256k1 standard signature format put recid back of signature but bitcoin put it front and add 27 or 31 for uncompressed or compressed public key

func Verify

func Verify(address string, sig []byte, msg []byte) bool

Types

type Key

type Key struct {
	// contains filtered or unexported fields
}

func FromBytes

func FromBytes(privateKey []byte) (*Key, error)

func FromWIF

func FromWIF(WIF string) (*Key, error)

func NewKey

func NewKey() *Key

func (Key) PublicKey

func (k Key) PublicKey() []byte

func (Key) Raw

func (k Key) Raw() []byte

func (Key) Sign

func (k Key) Sign(msg []byte) []byte

Add prefix contain recid for recovery. 31 + recid means recovery for compressed public key.

func (Key) ToAddress

func (k Key) ToAddress() string

func (Key) ToWIF

func (k Key) ToWIF() string

0x80 + raw private key + 0x01 + checksum 4 bytes

Jump to

Keyboard shortcuts

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