Golang 获取MD5的方法

import (
	"crypto/md5"
	"encoding/hex"
)

//生成32位md5字串
func Md5(s string) string {
	h := md5.New()
	h.Write([]byte(s))
	return hex.EncodeToString(h.Sum(nil))
}

  

posted @ 2018-01-22 10:23  换行程序员  阅读(4544)  评论(0编辑  收藏  举报