schnorr

package module
v0.0.0-...-54be66e Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2017 License: MIT Imports: 7 Imported by: 0

README

Schnorr Signature Algorithm

GoDoc

This Package implements the schnorr signature as defined in Wikipedia. Schnorr signature

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECPrivateKey

type ECPrivateKey struct {
	ECPublicKey
	Key *big.Int
}

func ECGenerateKeyPair

func ECGenerateKeyPair(curve elliptic.Curve, rand io.Reader) (pk *ECPrivateKey, e error)

type ECPublicKey

type ECPublicKey struct {
	elliptic.Curve
	X, Y *big.Int
}

type Group

type Group struct {
	P *big.Int
	G *big.Int
}

type KeyMAC

type KeyMAC interface {
	// Creates a new, keyed Hash.
	New(key []byte) hash.Hash

	// MaxHashSize returns the maximum number of bytes of the hash
	// that will be used. If Hash.Sum() yields more bytes, they'll
	// be cut off. Ideal is Hash.Sum()==MaxHashSize().
	MaxHashSize() int
}

MAC Algorithm, that spawns a keyed hash.Hash instance.

func HMAC

func HMAC(h func() hash.Hash, est int) KeyMAC

Implements Keyed-Hash Message Authentication Code (HMAC) est should be h().Size()

func SimpleHash

func SimpleHash(h func() hash.Hash, est int) KeyMAC

Implements HASH( key || message ) est should be h().Size()

func WrapMAC

func WrapMAC(h func(key []byte) hash.Hash, est int) KeyMAC

type PrivateKey

type PrivateKey struct {
	PublicKey
	Key *big.Int
}

func GenerateKeyPair

func GenerateKeyPair(group *Group, rand io.Reader) (pk *PrivateKey, e error)

type PublicKey

type PublicKey struct {
	Group
	A *big.Int
}

type Signer

type Signer interface {
	io.Writer

	GetSignature() (*big.Int, []byte)
}

func ECSign

func ECSign(rand io.Reader, pk *ECPrivateKey, mac KeyMAC) (Signer, error)

func Sign

func Sign(rand io.Reader, pk *PrivateKey, mac KeyMAC) (Signer, error)

type Verifier

type Verifier interface {
	io.Writer

	Verify() bool
}

func ECVerify

func ECVerify(pk *ECPublicKey, mac KeyMAC, s *big.Int, e []byte) Verifier

func Verify

func Verify(pk *PublicKey, mac KeyMAC, s *big.Int, e []byte) Verifier

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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