signature

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 2 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// PublicKeySize is the size, in bytes, of public keys as used in this package.
	PublicKeySize = 32
	// PrivateKeySize is the size, in bytes, of private keys as used in this package.
	PrivateKeySize = 64
	// SignatureSize is the size, in bytes, of signatures generated and verified by this package.
	SignatureSize = 64
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(rand io.Reader) (publicKey PublicKey, privateKey PrivateKey, err error)

GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, crypto/rand.Reader will be used.

func Sign

func Sign(privateKey PrivateKey, message []byte) []byte

Sign is used to signature the transaction.

func Verify

func Verify(publicKey PublicKey, message, sig []byte) bool

Verify is used to confirm whether the signature is right.

Types

type PrivateKey

type PrivateKey ed25519.PrivateKey

PrivateKey is a byte array, []byte.

func (PrivateKey) Public

func (priv PrivateKey) Public() PublicKey

Public returns the public key fo the private key.

type PublicKey

type PublicKey ed25519.PublicKey

PublicKey is a byte array, []byte.

Jump to

Keyboard shortcuts

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