fix golint issues in core/hash (#487)

This commit is contained in:
Kevin Wan
2021-02-19 18:14:34 +08:00
committed by GitHub
parent f238290dd3
commit 0c094cb2d7
3 changed files with 24 additions and 14 deletions

View File

@@ -7,16 +7,19 @@ import (
"github.com/spaolacci/murmur3"
)
// Hash returns the hash value of data.
func Hash(data []byte) uint64 {
return murmur3.Sum64(data)
}
// Md5 returns the md5 bytes of data.
func Md5(data []byte) []byte {
digest := md5.New()
digest.Write(data)
return digest.Sum(nil)
}
// Md5Hex returns the md5 hex string of data.
func Md5Hex(data []byte) string {
return fmt.Sprintf("%x", Md5(data))
}