Documentation ¶
Index ¶
- Constants
- func HashFile(path string, algorithm string) (string, error)
- func MD5FromBytes(bytes []byte) string
- func MD5FromReader(reader io.Reader) string
- func NewReader(r io.Reader, options ...Option) (io.Reader, error)
- func SHA256FromStrings(data ...string) string
- type Digest
- type Option
- type Reader
Constants ¶
View Source
const ( // AlgorithmSHA1 is sha1 algorithm name of hash. AlgorithmSHA1 = "sha1" // AlgorithmSHA256 is sha256 algorithm name of hash. AlgorithmSHA256 = "sha256" // AlgorithmSHA512 is sha512 algorithm name of hash. AlgorithmSHA512 = "sha512" // AlgorithmMD5 is md5 algorithm name of hash. AlgorithmMD5 = "md5" )
Variables ¶
This section is empty.
Functions ¶
func MD5FromBytes ¶
MD5FromBytes computes the MD5 checksum with []byte.
func MD5FromReader ¶
MD5FromReader computes the MD5 checksum with io.Reader.
func NewReader ¶
TODO add AF_ALG digest https://github.com/golang/sys/commit/e24f485414aeafb646f6fca458b0bf869c0880a1
func SHA256FromStrings ¶
SHA256FromStrings computes the SHA256 checksum with multiple strings.
Types ¶
type Digest ¶
type Digest struct { // Algorithm is hash algorithm. Algorithm string // Encoded is hash encode. Encoded string }
Digest provides digest operation function.
type Option ¶
type Option func(reader *reader)
Option is a functional option for digest reader.
func WithLogger ¶
func WithLogger(logger *logger.SugaredLoggerOnWith) Option
WithLogger sets the logger for digest reader.
Click to show internal directories.
Click to hide internal directories.