crypto

package
v0.0.0-...-67070f9 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encrypt

func Encrypt(data []byte, pubKey PublicKey) ([]byte, error)

func GetKeyDifficulty

func GetKeyDifficulty(key PublicKey) int

Types

type PrivateKey

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

func GenerateDifficultKey

func GenerateDifficultKey(difficulty uint) (key PrivateKey, err error)

GenerateDifficultKey generates key with required difficulty. It should take ~1-2s for difficulty 14.

func GeneratePrivateKey

func GeneratePrivateKey() (key PrivateKey, err error)

func (*PrivateKey) Decrypt

func (self *PrivateKey) Decrypt(raw []byte) ([]byte, error)

func (*PrivateKey) GetPublicKey

func (self *PrivateKey) GetPublicKey() PublicKey

func (*PrivateKey) Sign

func (self *PrivateKey) Sign(data []byte) ([]byte, error)

type PublicKey

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

func PublicKeyFromBytes

func PublicKeyFromBytes(b []byte) (key PublicKey, err error)

func (*PublicKey) Hex

func (self *PublicKey) Hex() string

func (*PublicKey) VerifySign

func (self *PublicKey) VerifySign(data []byte, signature []byte) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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