Documentation
¶
Overview ¶
Package stream implements different io interfaces to help with common operations
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShutdownMD5Hasher ¶
func ShutdownMD5Hasher()
ShutdownMD5Hasher must be called when we are done with using the md5hasher
Types ¶
type HashAlgorithm ¶
type HashAlgorithm string
HashAlgorithm provides a convenient way to have consistency when accessing default hash algorithms
var ( // SHA256 ... SHA256 HashAlgorithm = "SHA256" // MD5 ... MD5 HashAlgorithm = "MD5" )
list of hash algorithms with helper methods
func NewHashAlgorithm ¶
func NewHashAlgorithm(arg string) HashAlgorithm
NewHashAlgorithm is a utility function used for casting a string to hash algorithm enum
type HashWriter ¶
type HashWriter interface { io.Writer Hash(h HashAlgorithm) ([]byte, error) HexString(h HashAlgorithm) (string, error) Base64String(h HashAlgorithm) (string, error) Reset() }
HashWriter implements an io.writer that hashes the payload as operating on data while any hash.Hasher can be used as underlying hashing algorithm, at this point utility functions for md5 and sha256n are written
func NewHashWriter ¶
func NewHashWriter(writer io.Writer, opts ...HashWriterOption) (HashWriter, error)
NewHashWriter ...
type HashWriterOption ¶
type HashWriterOption func(*hashWriter) error
HashWriterOption ...
func WithHasher ¶
func WithHasher(algorithm HashAlgorithm, hasher hash.Hash) HashWriterOption
WithHasher sets underlying hash algorithms [WARN] => make sure s.hasher is allocated in memory before calling this function
func WithMD5 ¶
func WithMD5() HashWriterOption
WithMD5 is a sets up md5 hashing with minio's md5 Hasher.
func WithSHA256 ¶
func WithSHA256() HashWriterOption
WithSHA256 is a convenience method that adds sha256 hashing based on minio's library.
func WithWrappedLogger ¶
func WithWrappedLogger(arg *logger.WrappedLogger) HashWriterOption
WithWrappedLogger ...