ed25519

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package ed25519 provides an Ed25519 implementation backed by crypto/ed25519(https://pkg.go.dev/crypto/ed25519) std package, but using ed25519consensus(https://pkg.go.dev/github.com/hdevalence/ed25519consensus) package for signature verification, which conforms to [ZIP 215](https://zips.z.cash/zip-0215) specification, making it suitable for consensus-critical contexts, see [README from ed25519consensus](https://github.com/hdevalence/ed25519consensus) for the explanation.

It also provides an Ed25519-SHA3-512 implementation backed by [go-ed25519-sha3-512](https://pkg.go.dev/github.com/crpt/go-ed25519-sha3-512) package, which is a fork of crypto/ed25519(https://pkg.go.dev/crypto/ed25519) std package, modified to use SHA3-512 instead of SHA-512. using [go-ed25519consensus-sha3-512](https://pkg.go.dev/github.com/crpt/go-ed25519consensus-sha3-512) package for signature verification, which is a fork of ed25519consensus(https://pkg.go.dev/github.com/hdevalence/ed25519consensus) package, modified to use SHA3-512 instead of SHA-512. So it's also suitable for consensus-critical contexts.

Index

Constants

View Source
const (
	// 32
	PublicKeySize = ed25519.PublicKeySize
	// 64
	PrivateKeySize = ed25519.PrivateKeySize
	// 64
	SignatureSize = ed25519.SignatureSize
	// 64
	AddressSize = PublicKeySize
)

Variables

View Source
var (
	KeyTypeByte          = byte(crpt.Ed25519)
	KeyTypeByte_SHA3_512 = byte(crpt.Ed25519_SHA3_512)

	ErrWrongPublicKeySize       = fmt.Errorf("%w, should be 32 bytes", crpt.ErrWrongPublicKeySize)
	ErrWrongPrivateKeySize      = fmt.Errorf("%w, should be 64 bytes", crpt.ErrWrongPrivateKeySize)
	ErrWrongSignatureSize       = fmt.Errorf("%w, should be 64 bytes", crpt.ErrWrongSignatureSize)
	ErrNotEd25519PublicKey      = errors.New("not a Ed25519 public key")
	ErrNotEd25519SHA3PublicKey  = errors.New("not a Ed25519-SHA3-512 public key")
	ErrNotEd25519PrivateKey     = errors.New("not a Ed25519 private key")
	ErrNotEd25519SHA3PrivateKey = errors.New("not a Ed25519-SHA3-512 private key")
	ErrNotEd25519Signature      = errors.New("not a Ed25519 signature")
	ErrNotEd25519SHA3Signature  = errors.New("not a Ed25519-SHA3-512 signature")
)

Functions

func New

func New(sha3 bool, hash crypto.Hash) (*ed25519Crpt, error)

New creates an Ed225519 Crpt, if sha3 is true, it uses SHA3-512 hash function instead of normal SHA-512.

Types

type Address

type Address = crpt.Address

Ed25519 33-byte address (the same as TypedPublicKey)

Jump to

Keyboard shortcuts

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