crypto

package
v0.0.0-...-ec04e22 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAddress2

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

CreateAddress2 creates an ethereum address given the address bytes, initial contract code hash and a salt.

func Decrypt

func Decrypt(prv *ecdsa.PrivateKey, ct []byte) ([]byte, error)

func Ecrecover

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

func Encrypt

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

func FromECDSA

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

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 parses a secp256k1 private key.

func Keccak256

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

func Keccak256Hash

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

func LoadECDSA

func LoadECDSA(in io.Reader) (*ecdsa.PrivateKey, error)

LoadECDSA loads a secp256k1 private key from the given file. The key data is expected to be hex-encoded.

func PubkeyToAddress

func PubkeyToAddress(p ecdsa.PublicKey) common.Address

func Ripemd160

func Ripemd160(data []byte) []byte

func Sha256

func Sha256(data []byte) []byte

func Sha3 deprecated

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

Deprecated: For backward compatibility as other packages depend on these

func Sha3Hash

func Sha3Hash(data ...[]byte) common.Hash

func SigToPub

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

func Sign

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

func ToECDSA

func ToECDSA(prv []byte) *ecdsa.PrivateKey

New methods using proper ecdsa keys from the stdlib

func ToECDSAPub

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

func ValidateSignatureValues

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

func WriteECDSAKey

func WriteECDSAKey(to io.Writer, key *ecdsa.PrivateKey) (int, error)

WriteECDSAKey saves a secp256k1 private key to the given file with restrictive permissions. The key data is saved hex-encoded.

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