hash

package
v10.0.37 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChecksumCopy added in v10.0.8

func ChecksumCopy(dst io.Writer, src io.Reader) (int64, []byte, error)

ChecksumCopy will do the same as io.Copy, but also returns a sha256 checksum for the data read

func ChecksumFrom added in v10.0.7

func ChecksumFrom(r io.Reader, hasher hash.Hash) (int64, []byte, error)

ChecksumFrom will read all of r 8096 bytes at a time into hasher and return the sum

func Modulo

func Modulo(sha string, num int) int

Modulo returns the modulo of sha value into num

func Sha256Checksum added in v10.0.7

func Sha256Checksum(r io.Reader) ([]byte, error)

Sha256Checksum will return a sha256 checksum of r

func Values

func Values(objects ...interface{}) string

Values will convert all objects to a string and return a SHA256 of the concatenated values. Uses xxhash to calculate a faster hash value that is not cryptographically secure but is OK since we use hashing mainfully for generating consistent key values or equality checks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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