crypto

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

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

This section is empty.

Types

type PrivateKeyEd25519

type PrivateKeyEd25519 [PrivateKeySize]byte

PrivateKeyEd25519 is the private key container

func GeneratePrivateKey

func GeneratePrivateKey() PrivateKeyEd25519

GeneratePrivateKey generates a new private key

func PrivateKeyFromHex

func PrivateKeyFromHex(h string) (PrivateKeyEd25519, error)

PrivateKeyFromHex decodes a hexified private key into PrivateKeyEd25519

func PrivateKeyFromSecret

func PrivateKeyFromSecret(secret []byte) PrivateKeyEd25519

PrivateKeyFromSecret generates a private key from a given secret

func (PrivateKeyEd25519) Bytes

func (privKey PrivateKeyEd25519) Bytes() []byte

Bytes return the the private key as bytes

func (PrivateKeyEd25519) PubKey

func (privKey PrivateKeyEd25519) PubKey() PublicKeyEd25519

PubKey returns the public key for this private key

func (PrivateKeyEd25519) Sign

func (privKey PrivateKeyEd25519) Sign(msg []byte) []byte

Sign a message

func (PrivateKeyEd25519) ToHex

func (privKey PrivateKeyEd25519) ToHex() string

ToHex returns the private key as a hex value

type PublicKeyEd25519

type PublicKeyEd25519 [PublicKeySize]byte

PublicKeyEd25519 is the public key container

func PublicKeyFromBytes

func PublicKeyFromBytes(bits []byte) (PublicKeyEd25519, error)

func PublicKeyFromHex

func PublicKeyFromHex(h string) (PublicKeyEd25519, error)

PublicKeyFromHex decodes a hex version of the public key into PublicKeyEd25519

func (PublicKeyEd25519) Bytes

func (pubKey PublicKeyEd25519) Bytes() []byte

Bytes returns the public key as bytes

func (PublicKeyEd25519) ToHex

func (pubKey PublicKeyEd25519) ToHex() string

ToHex returns the public key as a hex

func (PublicKeyEd25519) Verify

func (pubKey PublicKeyEd25519) Verify(msg []byte, sig []byte) bool

Verify a signature and message

type Signature

type Signature [SignatureSize]byte

Signature is the signature container

Jump to

Keyboard shortcuts

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