首页 话题 小组 问答 好文 用户 我的社区 域名交易 唠叨

[程序]Golang sha256示例代码

发布于 2025-06-05 22:19:52
0
66


package main

import (
    "crypto/sha256"
    "encoding/hex"
    "fmt"
)

func encode(input []byte) string {
    hash := sha256.Sum256(input)
    return hex.EncodeToString(hash[:])
}

func main() {
    input := "1234567"
    encoded := encode([]byte(input))
    fmt.Println("Encoded:", encoded)
}
评论
一个月内的热帖推荐
宁儿
Lv.1来自QQ

452

帖子

22

小组

1735

积分

赞助商广告
站长交流