Ai
198 Star 567 Fork 254

lock-li/opms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
encrypt.go 399 Bytes
一键复制 编辑 原始数据 按行查看 历史
lock 提交于 2016-09-12 13:44 +08:00 . init opms
package utils
import (
"crypto/md5"
"crypto/rand"
"encoding/base64"
"encoding/hex"
"io"
)
//md5方法
func Md5(s string) string {
h := md5.New()
h.Write([]byte(s))
return hex.EncodeToString(h.Sum(nil))
}
//Guid方法
func GetGuid() string {
b := make([]byte, 48)
if _, err := io.ReadFull(rand.Reader, b); err != nil {
return ""
}
return Md5(base64.URLEncoding.EncodeToString(b))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/lock-upme/opms.git
git@gitee.com:lock-upme/opms.git
lock-upme
opms
opms
558463a10cc0

搜索帮助