weakhash

package
v0.14.18 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2017 License: MPL-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Size = 4
)

Variables

This section is empty.

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.

func NewHash

func NewHash(size int) hash.Hash32

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 wether it wishes to continue interating.

Jump to

Keyboard shortcuts

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