Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("hash type not supported")
ErrUnsupported should be returned by filesystem, if it is requested to deliver an unsupported hash type.
Functions ¶
func Equals ¶
Equals checks to see if src == dst, but ignores empty strings and returns true if either is empty.
func HelpString ¶ added in v1.56.0
HelpString returns help message with supported hashes
func StreamTypes ¶
StreamTypes will calculate hashes of the requested hash types.
Types ¶
type MultiHasher ¶
type MultiHasher struct {
// contains filtered or unexported fields
}
A MultiHasher will construct various hashes on all incoming writes.
func NewMultiHasher ¶
func NewMultiHasher() *MultiHasher
NewMultiHasher will return a hash writer that will write all supported hash types.
func NewMultiHasherTypes ¶
func NewMultiHasherTypes(set Set) (*MultiHasher, error)
NewMultiHasherTypes will return a hash writer that will write the requested hash types.
func (*MultiHasher) Size ¶
func (m *MultiHasher) Size() int64
Size returns the number of bytes written
func (*MultiHasher) Sum ¶ added in v1.55.0
func (m *MultiHasher) Sum(hashType Type) ([]byte, error)
Sum returns the specified hash from the multihasher
func (*MultiHasher) Sums ¶
func (m *MultiHasher) Sums() map[Type]string
Sums returns the sums of all accumulated hashes as hex encoded strings.
type Set ¶
type Set int
A Set Indicates one or more hash types.
func NewHashSet ¶
NewHashSet will create a new hash set with the hash types supplied
func Supported ¶
func Supported() Set
Supported returns a set of all the supported hashes by HashStream and MultiHasher.
func (Set) GetOne ¶
GetOne will return a hash type. Currently the first is returned, but it could be improved to return the strongest.
type Type ¶
type Type int
Type indicates a standard hashing algorithm
func RegisterHash ¶ added in v1.6.1
RegisterHash adds a new Hash to the list and returns it Type