ed25519

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EddsaPKLen   = 32
	EddsaVKLen   = 64
	EddsaSignLen = 64
)

length

View Source
const (
	// SeedSize is the Size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
	SeedSize = 32
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(rand io.Reader) (*EDDSAPrivateKey, *EDDSAPublicKey)

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

Types

type Bignum256

type Bignum256 = modm.Bignum256

Bignum256 variable

type EDDSAPrivateKey

type EDDSAPrivateKey [EddsaVKLen]byte

EDDSAPrivateKey : 64[]byte

func (*EDDSAPrivateKey) Bytes

func (key *EDDSAPrivateKey) Bytes() ([]byte, error)

Bytes return key bytes. Inverse method of FromBytes(k []byte, opt AlgorithmOption)

func (*EDDSAPrivateKey) FromBytes

func (key *EDDSAPrivateKey) FromBytes(k []byte, opt int) error

FromBytes parse a private Key from bytes, Inverse method of Bytes()

func (*EDDSAPrivateKey) Public

func (key *EDDSAPrivateKey) Public() crypto.PublicKey

Public Get EDDSAPublicKey from a EDDSAPrivateKey, if EDDSAPublicKey is empty, this method will invoke CalculatePublicKey().

func (*EDDSAPrivateKey) Sign

func (key *EDDSAPrivateKey) Sign(k, message []byte, _ io.Reader) (signature []byte, err error)

Sign signs the given message with priv. rand is ignored. If opts.HashFunc() is crypto.SHA512, the pre-hashed variant Ed25519ph is used and message is expected to be a SHA-512 hash, otherwise opts.HashFunc() must be crypto.Hash(0) and the message must not be hashed, as Ed25519 performs two passes over messages to be signed.

type EDDSAPublicKey

type EDDSAPublicKey [EddsaPKLen]byte

EDDSAPublicKey :32[]byte

func (*EDDSAPublicKey) Bytes

func (key *EDDSAPublicKey) Bytes() ([]byte, error)

Bytes return key bytes

func (*EDDSAPublicKey) FromBytes

func (key *EDDSAPublicKey) FromBytes(k []byte, opt int) error

FromBytes Parse a public key from 65 bytes and specific algorithm.The reverse method of Bytes()

func (*EDDSAPublicKey) Verify

func (key *EDDSAPublicKey) Verify(_ []byte, signature, message []byte) (bool, error)

Verify reports whether sig is a valid signature of message by publicKey. It will panic if len(publicKey) is not PublicKeySize.

type ExtendedGroupElement

type ExtendedGroupElement = ge25519.Ge25519

ExtendedGroupElement ge25519

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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