Documentation ¶
Index ¶
- type BadDigest
- type Reader
- func (r *Reader) ActualSize() int64
- func (r *Reader) MD5() []byte
- func (r *Reader) MD5Base64String() string
- func (r *Reader) MD5Current() []byte
- func (r *Reader) MD5HexString() string
- func (r *Reader) Read(p []byte) (n int, err error)
- func (r *Reader) SHA256() []byte
- func (r *Reader) SHA256HexString() string
- func (r *Reader) Size() int64
- func (r *Reader) Verify() error
- type SHA256Mismatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader writes what it reads from an io.Reader to an MD5 and SHA256 hash.Hash. Reader verifies that the content of the io.Reader matches the expected checksums.
func NewReader ¶
func NewReader(src io.Reader, size int64, md5Hex, sha256Hex string, actualSize int64, strictCompat bool) (*Reader, error)
NewReader returns a new hash Reader which computes the MD5 sum and SHA256 sum (if set) of the provided io.Reader at EOF.
func (*Reader) ActualSize ¶
ActualSize returns the pre-modified size of the object. DecompressedSize - For compressed objects.
func (*Reader) MD5Base64String ¶
MD5Base64String returns base64 encoded MD5sum value.
func (*Reader) MD5Current ¶
MD5Current - returns byte md5 value of the current state of the md5 hash after reading the incoming content. NOTE: Calling this function multiple times might yield different results if they are intermixed with Reader.
func (*Reader) MD5HexString ¶
MD5HexString returns hex md5 value.
func (*Reader) SHA256HexString ¶
SHA256HexString returns hex sha256 value.
type SHA256Mismatch ¶
SHA256Mismatch - when content sha256 does not match with what was sent from client.
func (SHA256Mismatch) Error ¶
func (e SHA256Mismatch) Error() string