keypair

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ZeroPublicKey is an instance of PublicKey consisting of all zeros
	ZeroPublicKey PublicKey
	// ZeroPrivateKey is an instance of PrivateKey consisting of all zeros
	ZeroPrivateKey PrivateKey
	// ErrPublicKey indicates the error of public key
	ErrPublicKey = errors.New("invalid public key")
	// ErrPrivateKey indicates the error of private key
	ErrPrivateKey = errors.New("invalid private key")
)

Functions

func BytesToPriKeyString

func BytesToPriKeyString(priKey []byte) (string, error)

BytesToPriKeyString converts a byte slice of private key to string

func BytesToPubKeyString

func BytesToPubKeyString(pubKey []byte) (string, error)

BytesToPubKeyString converts a byte slice of public key to string

func EncodePrivateKey

func EncodePrivateKey(priKey PrivateKey) string

EncodePrivateKey encodes a PrivateKey to string

func EncodePublicKey

func EncodePublicKey(pubKey PublicKey) string

EncodePublicKey encodes a PublicKey to string

func HashPubKey

func HashPubKey(pubKey PublicKey) hash.PKHash

HashPubKey returns the hash of public key

func StringToPriKeyBytes

func StringToPriKeyBytes(priKey string) ([]byte, error)

StringToPriKeyBytes converts a string of private key to byte slice

func StringToPubKeyBytes

func StringToPubKeyBytes(pubKey string) ([]byte, error)

StringToPubKeyBytes converts a string of public key to byte slice

Types

type PrivateKey

type PrivateKey [privKeyLength]byte

PrivateKey indicates the type 36 byte public key

func BytesToPrivateKey

func BytesToPrivateKey(priKey []byte) (PrivateKey, error)

BytesToPrivateKey converts a byte slice to PrivateKey

func DecodePrivateKey

func DecodePrivateKey(priKey string) (PrivateKey, error)

DecodePrivateKey decodes a string to PrivateKey

type PublicKey

type PublicKey [pubKeyLength]byte

PublicKey indicates the type of 72 byte public key

func BytesToPublicKey

func BytesToPublicKey(pubKey []byte) (PublicKey, error)

BytesToPublicKey converts a byte slice to PublicKey

func DecodePublicKey

func DecodePublicKey(pubKey string) (PublicKey, error)

DecodePublicKey decodes a string to PublicKey

Jump to

Keyboard shortcuts

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