sr25519

package
v0.34.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 109

Documentation

Index

Constants

View Source
const (
	PrivKeyName = "tendermint/PrivKeySr25519"
	PubKeyName  = "tendermint/PubKeySr25519"

	// SignatureSize is the size of an Edwards25519 signature. Namely the size of a compressed
	// Sr25519 point, and a field element. Both of which are 32 bytes.
	SignatureSize = 64
)
View Source
const PrivKeySize = 32

PrivKeySize is the number of bytes in an Sr25519 private key.

View Source
const (
	PubKeySize = 32
)

PubKeySize is the number of bytes in an Sr25519 public key.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrivKey added in v0.34.0

type PrivKey []byte

PrivKeySr25519 implements crypto.PrivKey.

func GenPrivKey

func GenPrivKey() PrivKey

GenPrivKey generates a new sr25519 private key. It uses OS randomness in conjunction with the current global random seed in tendermint/libs/common to generate the private key.

func GenPrivKeyFromSecret

func GenPrivKeyFromSecret(secret []byte) PrivKey

GenPrivKeyFromSecret hashes the secret with SHA2, and uses that 32 byte output to create the private key. NOTE: secret should be the output of a KDF like bcrypt, if it's derived from user input.

func (PrivKey) Bytes added in v0.34.0

func (privKey PrivKey) Bytes() []byte

Bytes returns the byte representation of the PrivKey.

func (PrivKey) Equals added in v0.34.0

func (privKey PrivKey) Equals(other crypto.PrivKey) bool

Equals - you probably don't need to use this. Runs in constant time based on length of the keys.

func (PrivKey) PubKey added in v0.34.0

func (privKey PrivKey) PubKey() crypto.PubKey

PubKey gets the corresponding public key from the private key.

func (PrivKey) Sign added in v0.34.0

func (privKey PrivKey) Sign(msg []byte) ([]byte, error)

Sign produces a signature on the provided message.

func (PrivKey) Type added in v0.34.0

func (privKey PrivKey) Type() string

type PubKey added in v0.34.0

type PubKey []byte

PubKeySr25519 implements crypto.PubKey for the Sr25519 signature scheme.

func (PubKey) Address added in v0.34.0

func (pubKey PubKey) Address() crypto.Address

Address is the SHA256-20 of the raw pubkey bytes.

func (PubKey) Bytes added in v0.34.0

func (pubKey PubKey) Bytes() []byte

Bytes returns the byte representation of the PubKey.

func (PubKey) Equals added in v0.34.0

func (pubKey PubKey) Equals(other crypto.PubKey) bool

Equals - checks that two public keys are the same time Runs in constant time based on length of the keys.

func (PubKey) String added in v0.34.0

func (pubKey PubKey) String() string

func (PubKey) Type added in v0.34.0

func (pubKey PubKey) Type() string

func (PubKey) VerifySignature added in v0.34.0

func (pubKey PubKey) VerifySignature(msg []byte, sig []byte) bool

Jump to

Keyboard shortcuts

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