crypto

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B64StringDecodePrivateKey

func B64StringDecodePrivateKey(enc string) (*ecdsa.PrivateKey, error)

func ByteHash256

func ByteHash256(raw []byte) common.Hash

func Checksum

func Checksum(payload []byte) []byte

func DefaultPubKey2Addr

func DefaultPubKey2Addr(p ecdsa.PublicKey) common.Address

func ECDSASign

func ECDSASign(hash []byte, prv *ecdsa.PrivateKey) ([]byte, error)

func ECDSASign2Hex

func ECDSASign2Hex(hash []byte, prv *ecdsa.PrivateKey) (string, error)

func GenPrvKey

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

func MustGenPrvKey

func MustGenPrvKey() *ecdsa.PrivateKey

func ParsePubKeyFromSignature

func ParsePubKeyFromSignature(sig []byte) (ecdsa.PublicKey, error)

func PrivateKeyEncodeB64String

func PrivateKeyEncodeB64String(key *ecdsa.PrivateKey) (string, error)

func PubKey2Addr

func PubKey2Addr(version uint8, p ecdsa.PublicKey) common.Address

func PubKeyEncode

func PubKeyEncode(p ecdsa.PublicKey) []byte

func PubKeySha256Hash

func PubKeySha256Hash(p ecdsa.PublicKey) common.Hash

func PubKeySha256HashBs

func PubKeySha256HashBs(p ecdsa.PublicKey) []byte

func VerifyAddress

func VerifyAddress(addr common.Address) bool

func VerifySignature

func VerifySignature(data []byte, sig []byte) bool

func VerifySignatureByPublic

func VerifySignatureByPublic(data []byte, sig []byte, pub *ecdsa.PublicKey) bool

func VerifySignatureFromHex

func VerifySignatureFromHex(data []byte, sigHex string) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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