Documentation ¶
Index ¶
- Variables
- func EncodePrivateKey(priKey PrivateKey) string
- func EncodePublicKey(pubKey PublicKey) string
- func HashPubKey(pubKey PublicKey) hash.Hash160
- func PrivateKeyToBytes(priKey PrivateKey) []byte
- func PublicKeyToBytes(pubKey PublicKey) []byte
- func StringToPubKeyBytes(pubKey string) ([]byte, error)
- type EC283PrivateKey
- type EC283PublicKey
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
var ( // ZeroPublicKey is an instance of PublicKey consisting of all zeros ZeroPublicKey EC283PublicKey // ZeroPrivateKey is an instance of PrivateKey consisting of all zeros ZeroPrivateKey EC283PrivateKey // 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 EncodePrivateKey ¶
func EncodePrivateKey(priKey PrivateKey) string
EncodePrivateKey encodes a SECP256K1 PrivateKey to string
func EncodePublicKey ¶
EncodePublicKey encodes a SECP256K1 PublicKey to string
func HashPubKey ¶
HashPubKey returns the hash of SECP256 public key
func PrivateKeyToBytes ¶ added in v0.4.4
func PrivateKeyToBytes(priKey PrivateKey) []byte
PrivateKeyToBytes converts a SECP256K1 PrivateKey to byte slice
func PublicKeyToBytes ¶ added in v0.4.4
PublicKeyToBytes converts a SECP256K1 PublicKey to byte slice
func StringToPubKeyBytes ¶
StringToPubKeyBytes converts a string of public key to byte slice
Types ¶
type EC283PrivateKey ¶ added in v0.4.4
type EC283PrivateKey [ec283privKeyLength]byte
EC283PrivateKey indicates the type 36 byte public key generated by EC283 library
func BytesToEC283PrivateKey ¶ added in v0.4.4
func BytesToEC283PrivateKey(priKey []byte) (EC283PrivateKey, error)
BytesToEC283PrivateKey converts a byte slice to PrivateKey
type EC283PublicKey ¶ added in v0.4.4
type EC283PublicKey [ec283pubKeyLength]byte
EC283PublicKey indicates the type of 72 byte public key generated by EC283 crypto library
func BytesToEC283PublicKey ¶ added in v0.4.4
func BytesToEC283PublicKey(pubKey []byte) (EC283PublicKey, error)
BytesToEC283PublicKey converts a byte slice to PublicKey
type PrivateKey ¶
type PrivateKey *ecdsa.PrivateKey
PrivateKey indicates the type of ECDSA public key generated by SECP256K1 library
func BytesToPrivateKey ¶
func BytesToPrivateKey(priKey []byte) (PrivateKey, error)
BytesToPrivateKey converts a byte slice to SECP256K1 PrivateKey
func DecodePrivateKey ¶
func DecodePrivateKey(priKey string) (PrivateKey, error)
DecodePrivateKey decodes a string to SECP256K1 PrivateKey
type PublicKey ¶
PublicKey indicates the type of ECDSA public key generated by SECP256K1 crypto library
func BytesToPublicKey ¶
BytesToPublicKey converts a byte slice to SECP256K1 PublicKey
func DecodePublicKey ¶
DecodePublicKey decodes a string to SECP256K1 PublicKey