2 Star 2 Fork 0

XiaoXiaoCaoOpenSource / Elog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
utils.go 388 Bytes
一键复制 编辑 原始数据 按行查看 历史
Tianyi 提交于 2023-11-03 16:37 . 修改 utils 工具包位置
package uitls
import (
"crypto/sha256"
"encoding/hex"
)
func GenHash(str string) string {
// 创建SHA256哈希对象
hash := sha256.New()
// 将字符串转换为字节数组并写入哈希对象
hash.Write([]byte(str))
// 计算哈希值
hashBytes := hash.Sum(nil)
// 将哈希值转换为十六进制字符串
hashStr := hex.EncodeToString(hashBytes)
return hashStr
}
Go
1
https://gitee.com/xxc_opensource/elog.git
git@gitee.com:xxc_opensource/elog.git
xxc_opensource
elog
Elog
v0.1.1-beta

搜索帮助