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

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))
}