shared

package
v0.0.0-...-4bb5581 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	T  = 150 // security param
	W  = 256 // bits - label size and Hx() output size
	WB = 32  // W in bytes
)
View Source
const RootIdentifier = Identifier("")

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	Data [T]Identifier // A list of T identifiers
}

func (*Challenge) Print

func (c *Challenge) Print()

type HashFunc

type HashFunc interface {

	// Hash takes arbitrary binary data and returns WB bytes
	Hash(data ...[]byte) []byte
	HashSingle(data []byte) []byte
}

func NewHashFunc

func NewHashFunc(x []byte) HashFunc

Returns a new HashFunc Hx() for commitment X

func NewScryptHashFunc

func NewScryptHashFunc(x []byte) HashFunc

Returns a new HashFunc Hx() for commitment X

type IBasicVerifier

type IBasicVerifier interface {

	// Verify proof p provided for challenge c using a verifier initialized with x and n where T and W shared between verifier and prover
	Verify(c Challenge, p Proof) bool

	VerifyNIP(p Proof) (bool, error)

	// Create a NIP challenge based on Phi (root label value provided by a proof)
	CreateNipChallenge(phi Label) (Challenge, error)

	// Create a random challenge, that consists of T random identifies (each n bits long)
	CreateRndChallenge() (Challenge, error)
}

type IProver

type IProver interface {
	ComputeDag() (phi Label, err error)
	GetProof(c Challenge) (Proof, error)
	GetNonInteractiveProof() (Proof, error)

	// for testing
	GetLabel(id Identifier) (Label, bool)
	GetHashFunction() HashFunc
	DeleteStore()
}

A simple POET prover

type Identifier

type Identifier string // variable-length binary string. e.g. "0011010" Only 0s and 1s are allows chars. Identifiers are n bits long.

type Label

type Label []byte // label is WB bytes long

type Labels

type Labels []Label // an ordered list of Labels

type Proof

type Proof struct {
	Phi Label     // dag root label value
	L   [T]Labels // T lists of labels - one for every of the T challenges
}

type ProofCreatedFunc

type ProofCreatedFunc func(phi Label, err error)

Jump to

Keyboard shortcuts

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