crypto

package
v0.0.0-...-f8b7a73 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressPubkey

func CompressPubkey(pubkey *ecdsa.PublicKey) []byte

compresspubkey将公钥编码为33字节的压缩格式。

func CreateAddress

func CreateAddress(b common.Address, nonce uint64) common.Address

createAddress创建一个给定字节和nonce的以太坊地址

func CreateAddress2

func CreateAddress2(b common.Address, salt [32]byte, inithash []byte) common.Address

createAddress2根据地址字节创建以太坊地址,初始 合同代码散列和盐。

func DecompressPubkey

func DecompressPubkey(pubkey []byte) (*ecdsa.PublicKey, error)

解压缩PubKey以33字节的压缩格式解析公钥。

func Ecrecover

func Ecrecover(hash, sig []byte) ([]byte, error)

ecrecover返回创建给定签名的未压缩公钥。

func FromECDSA

func FromECDSA(priv *ecdsa.PrivateKey) []byte

FromECDSA将私钥导出到二进制转储。

func FromECDSAPub

func FromECDSAPub(pub *ecdsa.PublicKey) []byte

func GenerateKey

func GenerateKey() (*ecdsa.PrivateKey, error)

func HexToECDSA

func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)

hextoecdsa解析secp256k1私钥。

func Keccak256

func Keccak256(data ...[]byte) []byte

keccak256计算并返回输入数据的keccak256哈希。

func Keccak256Hash

func Keccak256Hash(data ...[]byte) (h common.Hash)

keccak256 hash计算并返回输入数据的keccak256哈希, 将其转换为内部哈希数据结构。

func Keccak512

func Keccak512(data ...[]byte) []byte

keccak512计算并返回输入数据的keccak512哈希。

func LoadECDSA

func LoadECDSA(file string) (*ecdsa.PrivateKey, error)

loadecdsa从给定文件加载secp256k1私钥。

func PubkeyToAddress

func PubkeyToAddress(p ecdsa.PublicKey) common.Address

func S256

func S256() elliptic.Curve

s256返回secp256k1曲线的一个实例。

func SaveECDSA

func SaveECDSA(file string, key *ecdsa.PrivateKey) error

saveecdsa将secp256k1私钥保存到给定文件 限制权限。密钥数据保存为十六进制编码。

func SigToPub

func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)

sigtopub返回创建给定签名的公钥。

func Sign

func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error)

sign计算ECDSA签名。

此函数容易受到选中的可能泄漏的明文攻击 有关用于签名的私钥的信息。来电者必须 请注意,给定的哈希不能由对手选择。共同的 解决方案是在计算签名之前散列任何输入。

生成的签名采用[R V]格式,其中V为0或1。

func ToECDSA

func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)

toecdsa创建具有给定d值的私钥。

func ToECDSAUnsafe

func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey

ToecdsSaunsafe盲目地将二进制blob转换为私钥。它应该差不多 除非您确定输入有效并且希望避免敲击,否则不要使用。 源代码编码错误(0个前缀被切断)。

func UnmarshalPubkey

func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error)

UnmarshalSubkey将字节转换为secp256k1公钥。

func ValidateSignatureValues

func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool

validateSignatureValues使用验证签名值是否有效 给定的链规则。假设v值为0或1。

func VerifySignature

func VerifySignature(pubkey, hash, signature []byte) bool

VerifySignature checks that the given public key created signature over hash. 公钥应为压缩(33字节)或未压缩(65字节)格式。 签名应采用64字节[r_s]格式。

Types

This section is empty.

Directories

Path Synopsis
包bn256在256位的barreto-naehrig曲线上实现了最佳的ate对。
包bn256在256位的barreto-naehrig曲线上实现了最佳的ate对。
cloudflare
包BN256以128位安全性实现特定的双线性组 水平。
包BN256以128位安全性实现特定的双线性组 水平。
google
包BN256实现特定的双线性组。
包BN256实现特定的双线性组。
包secp256k1包装比特币secp256k1 c库。
包secp256k1包装比特币secp256k1 c库。

Jump to

Keyboard shortcuts

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