crypto

package
v0.0.0-...-e2a46ae Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var S256 = btcec.S256()

S256 is the secp256k1 elliptic curve

Functions

func CompressPubKey

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

func Ecrecover

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

func GenerateKey

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

GenerateKey generates a new key based on the secp256k1 elliptic curve.

func Keccak256

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

Keccak256 calculates the Keccak256

func MarshallPrivateKey

func MarshallPrivateKey(priv *ecdsa.PrivateKey) ([]byte, error)

func MarshallPublicKey

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

MarshallPublicKey marshalls a public key on the secp256k1 elliptic curve.

func ParseCompressedPubKey

func ParseCompressedPubKey(d []byte) (*ecdsa.PublicKey, error)

func ParsePrivateKey

func ParsePrivateKey(buf []byte) (*ecdsa.PrivateKey, error)

func ParsePublicKey

func ParsePublicKey(buf []byte) (*ecdsa.PublicKey, error)

ParsePublicKey parses bytes into a public key on the secp256k1 elliptic curve.

func RecoverPubkey

func RecoverPubkey(signature, hash []byte) (*ecdsa.PublicKey, error)

RecoverPubkey verifies the compact signature "signature" of "hash" for the secp256k1 curve.

func Sign

func Sign(priv *ecdsa.PrivateKey, hash []byte) ([]byte, error)

Sign produces a compact signature of the data in hash with the given private key on the secp256k1 curve.

Types

This section is empty.

Jump to

Keyboard shortcuts

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