Documentation ¶
Index ¶
- Constants
- Variables
- func CreateHash(hashType string) hash.Hash
- func HashFile(file string, hashType digest.Algorithm) string
- func Md5Bytes(bytes []byte) string
- func Md5Reader(reader io.Reader) string
- func NewDigestReader(log *logger.SugaredLoggerOnWith, reader io.Reader, digest ...string) io.Reader
- func Parse(digest string) []string
- func Sha256(values ...string) string
- func ToHashString(h hash.Hash) string
- type DigestReader
Constants ¶
View Source
const ( Sha256Hash digest.Algorithm = "sha256" Md5Hash digest.Algorithm = "md5" )
Variables ¶
View Source
var ( // Algorithms is used to check if an algorithm is supported. // If algo is not supported, Algorithms[algo] will return empty string. // Please don't use digest.Algorithm() to convert a string to digest.Algorithm. Algorithms = map[string]digest.Algorithm{ Sha256Hash.String(): Sha256Hash, Md5Hash.String(): Md5Hash, } )
View Source
var (
ErrDigestNotMatch = errors.New("digest not match")
)
Functions ¶
func CreateHash ¶
func HashFile ¶
HashFile computes hash value corresponding to hashType, hashType is from digestutils.Md5Hash and digestutils.Sha256Hash.
func NewDigestReader ¶
func ToHashString ¶
Types ¶
type DigestReader ¶
Click to show internal directories.
Click to hide internal directories.