checksum

package
v2.0.51 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DigestNames = maps.Keys(hashFunc)

Functions

func Checksum

func Checksum(src io.Reader, checksum DigestAlgorithm) (string, error)

func Copy

func Copy(checksums []DigestAlgorithm, src io.Reader, dst ...io.Writer) (map[DigestAlgorithm]string, error)

func GetHash

func GetHash(csType DigestAlgorithm) (hash.Hash, error)

func HashExists

func HashExists(csType DigestAlgorithm) bool

Types

type ChecksumWriter

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

func NewChecksumWriter

func NewChecksumWriter(checksums []DigestAlgorithm, writers ...io.Writer) (*ChecksumWriter, error)

func (*ChecksumWriter) Close

func (c *ChecksumWriter) Close() error

func (*ChecksumWriter) GetChecksums

func (c *ChecksumWriter) GetChecksums() (map[DigestAlgorithm]string, error)

func (*ChecksumWriter) Write

func (c *ChecksumWriter) Write(p []byte) (n int, err error)

type DigestAlgorithm

type DigestAlgorithm string
const (
	DigestMD5        DigestAlgorithm = "md5"
	DigestSHA1       DigestAlgorithm = "sha1"
	DigestSHA256     DigestAlgorithm = "sha256"
	DigestSHA512     DigestAlgorithm = "sha512"
	DigestBlake2b160 DigestAlgorithm = "blake2b-160"
	DigestBlake2b256 DigestAlgorithm = "blake2b-256"
	DigestBlake2b384 DigestAlgorithm = "blake2b-384"
	DigestBlake2b512 DigestAlgorithm = "blake2b-512"
)

func (*DigestAlgorithm) UnmarshalText added in v2.0.9

func (d *DigestAlgorithm) UnmarshalText(text []byte) error

type NullWriter

type NullWriter struct{}

func NewNullWriter

func NewNullWriter() *NullWriter

func (*NullWriter) Write

func (w *NullWriter) Write(b []byte) (int, error)

type WriterRunnerChecksum

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

func NewWriterRunnerChecksum

func NewWriterRunnerChecksum(alg DigestAlgorithm) (*WriterRunnerChecksum, error)

func (*WriterRunnerChecksum) Do

func (w *WriterRunnerChecksum) Do(reader io.Reader, done chan bool)

func (*WriterRunnerChecksum) GetAlgorithm

func (w *WriterRunnerChecksum) GetAlgorithm() DigestAlgorithm

func (*WriterRunnerChecksum) GetDigest

func (w *WriterRunnerChecksum) GetDigest() (string, error)

func (*WriterRunnerChecksum) GetName

func (w *WriterRunnerChecksum) GetName() string

Jump to

Keyboard shortcuts

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