wallet

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateECDSAKeyPair

func GenerateECDSAKeyPair(password []byte, salt []byte, iterations, keyLength int, useSHA512 bool) (*ecdsa.PrivateKey, []byte, error)

GenerateECDSAKeyPair 从一个给定的种子(seed)生成椭圆曲线(Elliptic Curve)的密钥对. 接受种子(seed)、哈希函数类型(useSHA512)、盐(salt)、迭代次数(iterations)和密钥长度(keyLength)作为参数。 使用 PBKDF2 算法和指定的哈希函数从种子生成密钥。 然后,使用这个密钥和椭圆曲线算法生成 ECDSA 密钥对。

func GetAddress

func GetAddress(pubKey []byte) string

GetAddress 返回公钥钱包地址

func GetPubKeyHash

func GetPubKeyHash(addr string) ([]byte, error)

GetPubKeyHash 从Base58编码的地址中提取公钥哈希。 参数 addressStr 是Base58编码的地址。 返回公钥哈希和可能发生的错误。

func GetPubKeyHashFromPrivKey

func GetPubKeyHashFromPrivKey(ownerPriv *ecdsa.PrivateKey) ([]byte, error)

GetPubKeyHashFromPrivKey 从ECDSA私钥中提取公钥哈希。 参数 ownerPriv 是ECDSA私钥。 返回公钥哈希和可能发生的错误。

func HashPubKey

func HashPubKey(pubKey []byte) []byte

hashPubKey 返回给定钥的 SHA-256 哈希值的 RIPEMD160 哈希值。 参数 pubKeyBytes 是公钥的字节表示。 返回公钥的哈希值。

func PubKeyHashGetAddress

func PubKeyHashGetAddress(pubKeyHash []byte) string

PubKeyHashGetAddress 返回公钥哈希对应的钱包地址

func ValidateAddress

func ValidateAddress(address string) bool

ValidateAddress 检查地址是否有效

Types

This section is empty.

Jump to

Keyboard shortcuts

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