crypto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: BSD-3-Clause Imports: 9 Imported by: 14 modules, 42 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AddressSize = 20
)

Variables

This section is empty.

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 GenerateSecp256k1Key

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

GenerateSecp256k1Key generates an ECDSA private key using secp256k1 elliptic curve.

func LegacyKeccak256 added in v0.2.0

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

func NewEthereumAddress

func NewEthereumAddress(p ecdsa.PublicKey) ([]byte, error)

NewEthereumAddress returns a binary representation of ethereum blockchain address. This function is based on github.com/ethereum/go-ethereum/crypto.PubkeyToAddress.

func NewOverlayAddress

func NewOverlayAddress(p ecdsa.PublicKey, networkID uint64) (swarm.Address, error)

NewOverlayAddress constructs a Swarm Address from ECDSA private key.

func Recover

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

Recover verifies signature with the data base provided. It is using `btcec.RecoverCompact` function

Types

type Signer

type Signer interface {
	Sign(data []byte) ([]byte, error)
	PublicKey() (*ecdsa.PublicKey, error)
}

func NewDefaultSigner

func NewDefaultSigner(key *ecdsa.PrivateKey) Signer

Jump to

Keyboard shortcuts

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