Documentation ¶
Index ¶
- func Hash32Bytes(data []byte, h hash.Hash32) uint32
- func Hash32File(path string, h hash.Hash32) (uint32, error)
- func Hash32Reader(r io.Reader, h hash.Hash32) (uint32, error)
- func Hash64Bytes(data []byte, h hash.Hash64) uint64
- func Hash64File(path string, h hash.Hash64) (uint64, error)
- func Hash64Reader(r io.Reader, h hash.Hash64) (uint64, error)
- type HashResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash32Bytes ¶
Hash32Bytes calculate 32 bit hash as uint result for byte array data.
Usage: Hash32Bytes(data, md5.New())
func Hash32File ¶
Hash32Reader calculate 32 bit hash as uint result for byte array data. The file is closed when hash calculating finish or an err occurred. If error occurred when read data, return 0 as result and a an error.
Usage: Hash32File(file, md5.New())
func Hash32Reader ¶
Hash32Reader calculate 32 bit hash as uint result for byte array data. If error occurred when read data, return 0 as result and a an error.
Usage: Hash32Reader(r, md5.New())
func Hash64Bytes ¶
Hash64Bytes calculate 64 bit hash as uint result for byte array data.
func Hash64File ¶
Hash64Reader calculate 64 bit hash as uint result for byte array data. The file is closed when hash calculating finish or an err occurred. If error occurred when read data, return 0 as result and a an error.
Types ¶
type HashResult ¶
type HashResult []byte
HashResult hold hash results
func HashBytes ¶
func HashBytes(data []byte, h hash.Hash) HashResult
HashBytes calculate hash for byte array data.
Usage: HashBytes(data, md5.New()), HashBytes(data, sha256.New())
func HashFile ¶
func HashFile(path string, h hash.Hash) (HashResult, error)
HashFile calculate hash for a file. The file is closed when hash calculating finish or an err occurred. If error occurred when read data, return nil result and a an error.
Usage: HashFile(file, md5.New()), HashFile(file, sha256.New())
func HashReader ¶
HashReader calculate hash for all data from reader. If error occurred when read data, return nil result and a an error.
Usage: HashReader(r, md5.New()), HashReader(r, sha256.New())
func (HashResult) ToHex ¶
func (r HashResult) ToHex() string
ToHex return hash result data as lower case hexed string
func (HashResult) ToHexUpper ¶
func (r HashResult) ToHexUpper() string
ToHexUpper return hash result data as upper case hexed string