Documentation ¶
Index ¶
- Variables
- func BytesToPriKeyString(priKey []byte) (string, error)
- func BytesToPubKeyString(pubKey []byte) (string, error)
- func EncodePrivateKey(priKey PrivateKey) string
- func EncodePublicKey(pubKey PublicKey) string
- func HashPubKey(pubKey PublicKey) hash.PKHash
- func StringToPriKeyBytes(priKey string) ([]byte, error)
- func StringToPubKeyBytes(pubKey string) ([]byte, error)
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
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 ¶
BytesToPriKeyString converts a byte slice of private key to string
func BytesToPubKeyString ¶
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 ¶
EncodePublicKey encodes a PublicKey to string
func HashPubKey ¶
HashPubKey returns the hash of public key
func StringToPriKeyBytes ¶
StringToPriKeyBytes converts a string of private key to byte slice
func StringToPubKeyBytes ¶
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 ¶
BytesToPublicKey converts a byte slice to PublicKey
func DecodePublicKey ¶
DecodePublicKey decodes a string to PublicKey