sortition

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UndefVerifiableSeed = VerifiableSeed{}

Functions

func GetIndex added in v0.13.0

func GetIndex(proof Proof, max uint64) uint64

func Verify added in v0.13.0

func Verify(seed VerifiableSeed, publicKey crypto.PublicKey, proof Proof, max uint64) (index uint64, result bool)

Verify ensures the proof is valid.

func VerifyProof

func VerifyProof(seed VerifiableSeed, proof Proof, public crypto.PublicKey, total, threshold int64) bool

Types

type Proof

type Proof [48]byte

func Evaluate added in v0.13.0

func Evaluate(seed VerifiableSeed, signer crypto.Signer, max uint64) (index uint64, proof Proof)

Evaluate returns a random number between 0 and max with the proof.

func EvaluateSortition

func EvaluateSortition(seed VerifiableSeed, signer crypto.Signer, total, threshold int64) (bool, Proof)

func ProofFromBytes

func ProofFromBytes(data []byte) (Proof, error)

func ProofFromString

func ProofFromString(text string) (Proof, error)

type VerifiableSeed

type VerifiableSeed [48]byte

func VerifiableSeedFromBytes

func VerifiableSeedFromBytes(data []byte) (VerifiableSeed, error)

func VerifiableSeedFromString

func VerifiableSeedFromString(text string) (VerifiableSeed, error)

func (*VerifiableSeed) GenerateNext added in v0.10.0

func (s *VerifiableSeed) GenerateNext(signer crypto.Signer) VerifiableSeed

func (*VerifiableSeed) Verify

func (s *VerifiableSeed) Verify(public crypto.PublicKey, prevSeed VerifiableSeed) bool

Jump to

Keyboard shortcuts

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