add util for md5

This commit is contained in:
Chris Lu 2020-04-08 22:30:38 -07:00
parent ed98223b08
commit 00b993a234

View file

@ -2,6 +2,7 @@ package util
import ( import (
"crypto/md5" "crypto/md5"
"fmt"
"io" "io"
) )
@ -91,3 +92,9 @@ func HashToInt32(data []byte) (v int32) {
return return
} }
func Md5(data []byte) string {
hash := md5.New()
hash.Write(data)
return fmt.Sprintf("%x", hash.Sum(nil))
}