model

package
v0.0.0-...-1337c0d Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExhaustedSalts = fmt.Errorf("exhausted possible salts without finding a solution")

Functions

This section is empty.

Types

type CommitObject

type CommitObject struct {
	Raw     []byte
	Payload []byte
	Hash    *digest.HexObjectDigest
}

type DigestPrefixSolver

type DigestPrefixSolver interface {
	// Solve finds a valid permutation of the ObjectTemplate for which the digest matches the given prefix
	Solve(obj *ObjectTemplate, prefix []byte) (*CommitObject, error)
}

type ObjectTemplate

type ObjectTemplate struct {
	Bytes         []byte
	PayloadOffset int
	SaltOffset    int
}

func (*ObjectTemplate) Copy

func (t *ObjectTemplate) Copy() *ObjectTemplate

func (*ObjectTemplate) Payload

func (t *ObjectTemplate) Payload() []byte

func (*ObjectTemplate) SetSalt

func (t *ObjectTemplate) SetSalt(salt uint64)

func (*ObjectTemplate) Sum

type SolverFactory

type SolverFactory interface {
	NewSolver(startSalt, endSalt uint64) DigestPrefixSolver
}

Jump to

Keyboard shortcuts

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