storageproof

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Version = 1

Variables

This section is empty.

Functions

func HammingDistance added in v1.0.9

func HammingDistance(a, b []byte) int

HammingDistance calculates the hamming distance between two byte slices

func Plot

func Plot(destDir string, kValue uint32, verbose bool) error

Types

type Header struct {
	Version    uint32
	NumKeys    uint32
	LibVersion [32]byte // Fixed-size array for a 32-character string
}

func (*Header) MarshalBinary

func (h *Header) MarshalBinary() ([]byte, error)

func (*Header) UnmarshalBinary

func (h *Header) UnmarshalBinary(data []byte) error

type KeyEntry

type KeyEntry struct {
	Offset uint64
	Hash   [32]byte // Assuming a 32-byte hash output
}

func (*KeyEntry) MarshalBinary

func (ke *KeyEntry) MarshalBinary() ([]byte, error)

func (*KeyEntry) UnmarshalBinary

func (ke *KeyEntry) UnmarshalBinary(data []byte) error

type PlotCollection

type PlotCollection struct {
	Plots map[string]*PlotInfo
}

func LoadPlots

func LoadPlots(paths []string, verbose bool) (*PlotCollection, error)

func (*PlotCollection) LookUp

func (pc *PlotCollection) LookUp(challengeHash []byte) (*Solution, error)

type PlotInfo

type PlotInfo struct {
	*Header
	KeyEntries []KeyEntry
}

type Shake256SignerOpts added in v1.0.10

type Shake256SignerOpts struct {
	// The desired output length in bytes.
	// For 256-bit security, use at least 64 bytes (512 bits) of output.
	OutputLen int
}

Shake256SignerOpts implements crypto.SignerOpts for SHAKE256.

func (Shake256SignerOpts) HashFunc added in v1.0.10

func (o Shake256SignerOpts) HashFunc() crypto.Hash

HashFunc returns 0 because SHAKE256 is an XOF, not a fixed hash. A value of 0 signals to the signer that the hash will be provided as a digest with a flexible length, as is the case for SHAKE.

type Solution added in v1.0.9

type Solution struct {
	Hash      string `json:"hash"`
	Distance  int    `json:"distance"`
	PublicKey string `json:"public_key"`
	Signature string `json:"signature"`
}

func BestMatch added in v1.0.9

func BestMatch(solutions []*Solution) *Solution

BestMatch returns the best solution from a slice of solutions

func NewSolution added in v1.0.9

func NewSolution(challengeHash []byte, distance int, sk *mldsa87.PrivateKey) (*Solution, error)

func (*Solution) Verify added in v1.0.9

func (s *Solution) Verify() (bool, error)