yummy5
2018-10-06 16:42
执行后发现 hash 值是乱码的这个是为什么?
func (b *Block)SetHash(){
//时间戳转城 字节数组
timestamp :=[]byte(strconv.FormatInt(b.Timestamp,10))
//[]byte 是字符数组类型 用join 连接起来
headers:= bytes.Join([][]byte{b.PrevBlockHash,b.Data,timestamp},[]byte{})
//fmt.Println(headers)
hash:= sha256.Sum256(headers)
b.Hash = hash[:]
}
....输出的问题,%x
私有区块链,我们一起GO
24300 学习 · 51 问题
相似问题