crypto

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rand32

func Rand32() [32]byte

func VerifySigHashedPub

func VerifySigHashedPub(hashedPub [32]byte, signature Signature, msg Hasher) bool

func VerifySigPub

func VerifySigPub(pub *btcec.PublicKey, signature Signature, msg Hasher) bool

Types

type Hash

type Hash [32]byte
var ZeroHash Hash

func Blake2B256

func Blake2B256(data ...[]byte) Hash

func HashPub

func HashPub(pub *btcec.PublicKey) Hash

func NewHashFromBytes

func NewHashFromBytes(b []byte) (Hash, error)

func NewHashFromHex

func NewHashFromHex(in string) (Hash, error)

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (*Hash) Decode

func (h *Hash) Decode(r io.Reader) error

func (Hash) Encode

func (h Hash) Encode(w io.Writer) error

func (Hash) Hash

func (h Hash) Hash() (Hash, error)

func (*Hash) MarshalJSON

func (h *Hash) MarshalJSON() ([]byte, error)

func (Hash) String

func (h Hash) String() string

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(b []byte) error

type Hasher

type Hasher interface {
	Hash() (Hash, error)
}

type SECP256k1Signer

type SECP256k1Signer struct {
	// contains filtered or unexported fields
}

func NewSECP256k1Signer

func NewSECP256k1Signer(pk *btcec.PrivateKey) *SECP256k1Signer

func (*SECP256k1Signer) Pub

func (s *SECP256k1Signer) Pub() *btcec.PublicKey

func (*SECP256k1Signer) Sign

func (s *SECP256k1Signer) Sign(hasher Hasher) (Signature, error)

type Signature

type Signature [65]byte

func NewSignatureFromBytes

func NewSignatureFromBytes(b []byte) (Signature, error)

func (Signature) String

func (s Signature) String() string

type Signer

type Signer interface {
	Sign(Hasher) (Signature, error)
	Pub() *btcec.PublicKey
}

Jump to

Keyboard shortcuts

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