crypto

package
v0.2.29 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blake2b160

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

Blake2b160 -

Types

type Curve

type Curve interface {
	GeneratePrivateKey() ([]byte, []byte, error)
	GetPublicKey(privateKey []byte) ([]byte, error)
	Sign(data []byte, privateKey []byte) (Signature, error)
	Verify(data []byte, signature []byte, pubKey []byte) bool
	AddressPrefix() []byte
	PublicKeyPrefix() []byte
	Kind() ECKind
}

Curve -

func NewCurve

func NewCurve(kind ECKind) (Curve, error)

NewCurve -

func NewCurveFromPrefix

func NewCurveFromPrefix(prefix string) (Curve, error)

NewCurveFromPrefix -

type ECKind

type ECKind int

ECKind -

const (
	KindEd25519 ECKind = iota + 1
	KindSecp256k1
	KindNistP256
)

type Ed25519

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

Ed25519 -

func NewEd25519

func NewEd25519() Ed25519

NewEd25519 -

func (Ed25519) AddressPrefix

func (curve Ed25519) AddressPrefix() []byte

AddressPrefix -

func (Ed25519) GeneratePrivateKey

func (curve Ed25519) GeneratePrivateKey() ([]byte, []byte, error)

GeneratePrivateKey -

func (Ed25519) GetPublicKey

func (curve Ed25519) GetPublicKey(privateKey []byte) ([]byte, error)

GetPublicKey -

func (Ed25519) Kind

func (curve Ed25519) Kind() ECKind

Kind -

func (Ed25519) PublicKeyPrefix

func (curve Ed25519) PublicKeyPrefix() []byte

PublicKeyPrefix -

func (Ed25519) Sign

func (curve Ed25519) Sign(data []byte, privateKey []byte) (Signature, error)

Sign -

func (Ed25519) Verify

func (curve Ed25519) Verify(data []byte, signature []byte, pubKey []byte) bool

Verify -

type Key

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

Key -

func NewKey

func NewKey(curveKind ECKind) (Key, error)

NewKey -

func NewKeyFromBase58

func NewKeyFromBase58(data string) (Key, error)

NewKeyFromBase58 -

func NewKeyFromBytes

func NewKeyFromBytes(bytes []byte, curveKind ECKind) (Key, error)

NewKeyFromBytes -

func (Key) Address

func (key Key) Address() (string, error)

Address -

func (Key) Bytes

func (key Key) Bytes() []byte

Bytes -

func (Key) Hex

func (key Key) Hex() string

Hex -

func (Key) Sign

func (key Key) Sign(data []byte) (Signature, error)

Sign -

func (Key) String

func (key Key) String() string

String -

func (Key) Verify

func (key Key) Verify(data, signature []byte) bool

Verify -

type PubKey

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

PubKey -

func NewPubKey

func NewPubKey(bytes []byte, curveKind ECKind) (PubKey, error)

NewPubKey -

func NewPubKeyFromBase58

func NewPubKeyFromBase58(data string) (PubKey, error)

NewPubKeyFromBase58 -

func (PubKey) Address

func (pk PubKey) Address() (string, error)

Address -

func (PubKey) Base58

func (pk PubKey) Base58() (string, error)

Base58 -

func (PubKey) Bytes

func (pk PubKey) Bytes() []byte

Bytes -

func (PubKey) Hex

func (pk PubKey) Hex() string

Hex -

func (PubKey) String

func (pk PubKey) String() string

String -

func (PubKey) Verify

func (pk PubKey) Verify(data, signature []byte) bool

Verify -

type Signature

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

Signature -

func NewSignature

func NewSignature(bytes []byte, prefix []byte) Signature

NewSignature -

func (Signature) Base58

func (s Signature) Base58() (string, error)

Base58 -

func (Signature) Bytes

func (s Signature) Bytes() []byte

Bytes -

func (Signature) Hex

func (s Signature) Hex() string

Hex -

func (Signature) String

func (s Signature) String() string

String -

Jump to

Keyboard shortcuts

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