[Go] go下实现md5加密

下面这个工具包下的函数

package utils

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

//md5加密
func Md5(src string) string {
    m := md5.New()
    m.Write([]byte(src))
    res := hex.EncodeToString(m.Sum(nil))
    return res
}

 

pass:=utils.Md5("test")

 

posted @ 2020-12-08 11:39  唯一客服系统开发笔记  阅读(935)  评论(0编辑  收藏  举报