md5.go 210 Bytes
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13
package hashutil

import (
	"crypto/md5"
	"encoding/hex"
	"github.com/spf13/cast"
)

func Md5(s interface{}) string {
	m := md5.New()
	m.Write([]byte(cast.ToString(s)))
	return hex.EncodeToString(m.Sum(nil))
}