crypto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSigToPubTypeNotFound is reported if the type is already used.
	ErrSigToPubTypeNotFound = fmt.Errorf("type of sigToPub is not found")

	// ErrSigToPubTypeAlreadyExist is reported if the type is already used.
	ErrSigToPubTypeAlreadyExist = fmt.Errorf("type of sigToPub is already exist")
)

Functions

func Keccak256Hash

func Keccak256Hash(data ...[]byte) (h common.Hash)

Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.

func RegisterSigToPub

func RegisterSigToPub(sigType string, sigToPub SigToPubFn) error

RegisterSigToPub registers a sigToPub function of type.

Types

type PrivateKey

type PrivateKey interface {
	// PublicKey returns the public key associate this private key.
	PublicKey() PublicKey

	// Sign calculates a signature.
	Sign(hash common.Hash) (Signature, error)
}

PrivateKey describes the asymmetric cryptography interface that interacts with the private key.

type PublicKey

type PublicKey interface {
	// VerifySignature checks that the given public key created signature over hash.
	VerifySignature(hash common.Hash, signature Signature) bool

	// Bytes returns the []byte representation of public key.
	Bytes() []byte
}

PublicKey describes the asymmetric cryptography interface that interacts with the public key.

func SigToPub

func SigToPub(hash common.Hash, signature Signature) (PublicKey, error)

SigToPub recovers public key from signature.

type SigToPubFn

type SigToPubFn func(hash common.Hash, signature Signature) (PublicKey, error)

SigToPubFn is a function to recover public key from signature.

type Signature

type Signature struct {
	Type      string
	Signature []byte
}

Signature is the basic signature type in DEXON.

func (Signature) Clone

func (sig Signature) Clone() Signature

Clone returns a deep copy of a signature.

func (Signature) String

func (sig Signature) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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