crypto

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressSize = 20
)

Variables

View Source
var ErrBadHashLength = errors.New("wrong block hash length")

Functions

func DecodeSecp256k1PrivateKey

func DecodeSecp256k1PrivateKey(data []byte) (*ecdsa.PrivateKey, error)

DecodeSecp256k1PrivateKey decodes raw ECDSA private key.

func EncodeSecp256k1PrivateKey

func EncodeSecp256k1PrivateKey(k *ecdsa.PrivateKey) []byte

EncodeSecp256k1PrivateKey encodes raw ECDSA private key.

func EncodeSecp256k1PublicKey

func EncodeSecp256k1PublicKey(k *ecdsa.PublicKey) []byte

EncodeSecp256k1PublicKey encodes raw ECDSA public key in a 33-byte compressed format.

func GenerateSecp256k1Key

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

GenerateSecp256k1Key generates an ECDSA private key using secp256k1 elliptic curve.

func GenerateSecpPrivateKeyFromString

func GenerateSecpPrivateKeyFromString(privateKey string) (*ecdsa.PrivateKey, error)

GenerateSecp256k1Key generates an ECDSA private key using secp256k1 elliptic curve.

func LegacyKeccak256

func LegacyKeccak256(data []byte) ([]byte, error)

func NewEthereumAddress

func NewEthereumAddress(p ecdsa.PublicKey) []byte

func Secp256k1PrivateKeyFromBytes

func Secp256k1PrivateKeyFromBytes(data []byte) *ecdsa.PrivateKey

Secp256k1PrivateKeyFromBytes returns an ECDSA private key based on the byte slice.

Types

type RecoverFunc

type RecoverFunc func(signature, data []byte) (*ecdsa.PublicKey, error)

RecoverFunc is a function to recover the public key from a signature

Jump to

Keyboard shortcuts

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