tendermint: github.com/tendermint/tendermint/crypto/ed25519 Index | Files

package ed25519

import "github.com/tendermint/tendermint/crypto/ed25519"

Index

Package Files

ed25519.go

Constants

const (
    PrivKeyName = "tendermint/PrivKeyEd25519"
    PubKeyName  = "tendermint/PubKeyEd25519"
    // PubKeySize is is the size, in bytes, of public keys as used in this package.
    PubKeySize = 32
    // PrivateKeySize is the size, in bytes, of private keys as used in this package.
    PrivateKeySize = 64
    // Size of an Edwards25519 signature. Namely the size of a compressed
    // Edwards25519 point, and a field element. Both of which are 32 bytes.
    SignatureSize = 64
    // SeedSize is the size, in bytes, of private key seeds. These are the
    // private key representations used by RFC 8032.
    SeedSize = 32
)

type PrivKey Uses

type PrivKey []byte

PrivKey implements crypto.PrivKey.

func GenPrivKey Uses

func GenPrivKey() PrivKey

GenPrivKey generates a new ed25519 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 Uses

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 Uses

func (privKey PrivKey) Bytes() []byte

Bytes returns the privkey byte format.

func (PrivKey) Equals Uses

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 Uses

func (privKey PrivKey) PubKey() crypto.PubKey

PubKey gets the corresponding public key from the private key.

Panics if the private key is not initialized.

func (PrivKey) Sign Uses

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

Sign produces a signature on the provided message. This assumes the privkey is wellformed in the golang format. The first 32 bytes should be random, corresponding to the normal ed25519 private key. The latter 32 bytes should be the compressed public key. If these conditions aren't met, Sign will panic or produce an incorrect signature.

func (PrivKey) Type Uses

func (privKey PrivKey) Type() string

type PubKey Uses

type PubKey []byte

PubKeyEd25519 implements crypto.PubKey for the Ed25519 signature scheme.

func (PubKey) Address Uses

func (pubKey PubKey) Address() crypto.Address

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

func (PubKey) Bytes Uses

func (pubKey PubKey) Bytes() []byte

Bytes returns the PubKey byte format.

func (PubKey) Equals Uses

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

func (PubKey) String Uses

func (pubKey PubKey) String() string

func (PubKey) Type Uses

func (pubKey PubKey) Type() string

func (PubKey) VerifyBytes Uses

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

Package ed25519 imports 8 packages (graph) and is imported by 140 packages. Updated 2020-06-16. Refresh now. Tools for package owners.