hasher

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAlg

func RegisterAlg(algName string, f InitFunc) bool

Registers init func for @algName algorithm

Types

type FileHasher

type FileHasher interface {
	HashFile(fileName string) (string, error)
}

Expands default Go Hash interface

func NewFileHasher

func NewFileHasher(algName string, log *logrus.Logger) FileHasher

Returns new FileHasher instance

type Hasher

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

func (*Hasher) HashData

func (fh *Hasher) HashData(r *bytes.Reader) (string, error)

HashData calculates hash for a data represented with @r. Uses default Go Hash interface.

func (*Hasher) HashFile

func (fh *Hasher) HashFile(fullFileName string) (string, error)

HashFile calculates hash for file

type InitFunc

type InitFunc func() hash.Hash

Jump to

Keyboard shortcuts

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