mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add util for md5
This commit is contained in:
parent
ed98223b08
commit
00b993a234
|
@ -2,6 +2,7 @@ package util
|
|||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
|
@ -91,3 +92,9 @@ func HashToInt32(data []byte) (v int32) {
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func Md5(data []byte) string {
|
||||
hash := md5.New()
|
||||
hash.Write(data)
|
||||
return fmt.Sprintf("%x", hash.Sum(nil))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue