[Go] go下实现md5加密

Posted taoshihan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[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")

 

以上是关于[Go] go下实现md5加密的主要内容,如果未能解决你的问题,请参考以下文章