欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Go语言MD5加密用法实例

程序员文章站 2023-02-16 22:12:53
本文实例讲述了go语言md5加密用法。分享给大家供大家参考。具体实现方法如下: 复制代码 代码如下:import (     "crypt...

本文实例讲述了go语言md5加密用法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:
import (
    "crypto/md5"
    "encoding/hex"
)
func main() {
    h := md5.new()
    h.write([]byte("sharejs.com")) // 需要加密的字符串为 sharejs.com
    fmt.printf("%s\n", hex.encodetostring(h.sum(nil))) // 输出加密结果
}

ps:这里再为大家提供2款md5加密工具,感兴趣的朋友可以参考一下:

md5在线加密工具:

http://tools.jb51.net/password/createmd5password

在线md5/hash/sha-1/sha-2/sha-256/sha-512/sha-3/ripemd-160加密工具:

希望本文所述对大家的go语言程序设计有所帮助。