hashutil

package
v0.0.0-...-1907995 Latest Latest
Warning

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

Go to latest
Published: May 6, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hashutil contains misc hashing functions lacking homes elsewhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SHA1Prefix

func SHA1Prefix(data []byte) string

SHA1Prefix computes the SHA-1 digest of data and returns its first twenty lowercase hex digits.

func SHA256Prefix

func SHA256Prefix(data []byte) string

SHA256Prefix computes the SHA-256 digest of data and returns its first twenty lowercase hex digits.

Types

type TrackDigestReader

type TrackDigestReader struct {

	// DoLegacySHA1 sets whether to also compute the legacy SHA-1 hash.
	DoLegacySHA1 bool
	// contains filtered or unexported fields
}

TrackDigestReader is an io.Reader wrapper which records the digest of what it reads.

func NewTrackDigestReader

func NewTrackDigestReader(r io.Reader) *TrackDigestReader

func (*TrackDigestReader) Hash

func (t *TrackDigestReader) Hash() hash.Hash

Hash returns the current hash sum.

func (*TrackDigestReader) LegacySHA1Hash

func (t *TrackDigestReader) LegacySHA1Hash() hash.Hash

LegacySHA1Hash returns the current legacy SHA-1 hash sum.

func (*TrackDigestReader) Read

func (t *TrackDigestReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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