nightingale/vendor/github.com/toolkits/pkg/str/md5.go

14 lines
187 B
Go

package str
import (
"crypto/md5"
"encoding/hex"
"io"
)
func MD5(str string) string {
hasher := md5.New()
io.WriteString(hasher, str)
return hex.EncodeToString(hasher.Sum(nil))
}