hashing

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadSumer added in v0.12.0

type ReadSumer interface {
	io.Reader
	// Sum returns the hash of the data read so far.
	Sum(d []byte) []byte
}

ReadSumer hashes all data read from the underlying reader.

func NewReader

func NewReader(r io.Reader, h hash.Hash) ReadSumer

NewReader returns a new ReadSummer that uses the hash h. If the underlying reader supports WriteTo then the returned reader will do so too.

type Writer

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

Writer transparently hashes all data while writing it to the underlying writer.

func NewWriter

func NewWriter(w io.Writer, h hash.Hash) *Writer

NewWriter wraps the writer w and feeds all data written to the hash h.

func (*Writer) Sum

func (h *Writer) Sum(d []byte) []byte

Sum returns the hash of all data written so far.

func (*Writer) Write

func (h *Writer) Write(p []byte) (int, error)

Write wraps the write method of the underlying writer and also hashes all data.

Jump to

Keyboard shortcuts

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