crypto
Node.js
const crypto = require('crypto')
const hash = crypto.createHash('sha256').update(Buffer.from('hello')).digest()
console.log(hash.toString('hex'))
Output
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Go
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
)
func main() {
hash := sha256.Sum256([]byte("hello"))
fmt.Println(hex.EncodeToString(hash[:]))
}
Output
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
当前内容版权归 miguelmota 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 miguelmota .