weakhash

package
v0.0.0-...-b5ba5ed Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Size = 4
)

Variables

This section is empty.

Functions

func Find

func Find(ctx context.Context, ir io.Reader, hashesToFind []uint32, size int) (map[uint32][]int64, error)

Find finds all the blocks of the given size within io.Reader that matches the hashes provided, and returns a hash -> slice of offsets within reader map, that produces the same weak hash.

Types

type Finder

type Finder struct {
	// contains filtered or unexported fields
}

func NewFinder

func NewFinder(ctx context.Context, ir io.ReadSeeker, size int, hashesToFind []uint32) (*Finder, error)

func (*Finder) Iterate

func (h *Finder) Iterate(hash uint32, buf []byte, iterFunc func(int64) bool) (bool, error)

Iterate iterates all available blocks that matches the provided hash, reads them into buf, and calls the iterator function. The iterator function should return whether it wishes to continue iterating.

Jump to

Keyboard shortcuts

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