weakhash

package
v0.14.30 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Size = 4
)

Variables

View Source
var (
	Enabled = true
)

Functions

func Find

func Find(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(path string, size int, hashesToFind []uint32) (*Finder, error)

func (*Finder) Close

func (h *Finder) Close()

Close releases any resource associated with the finder

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