Demo entry 6749204

大作业

   

Submitted by anonymous on Jun 12, 2018 at 13:38
Language: Go. Code size: 238 Bytes.

func calculateHash(block Block) string {
	record := string(block.Index) + block.Timestamp + string((block.DATA)) + block.PrevHash
	h := sha256.New()
	h.Write([]byte(record))
	hashed := h.Sum(nil)
	return hex.EncodeToString(hashed)
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).