hashing

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 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 Reader

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

Reader hashes all data read from the underlying reader.

func NewReader

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

NewReader returns a new Reader that uses the hash h.

func (*Reader) Read

func (h *Reader) Read(p []byte) (int, error)

func (*Reader) Sum

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

Sum returns the hash of the data read so far.

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