Skip to content

Instantly share code, notes, and snippets.

@nosequeldeebee
Created January 29, 2018 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosequeldeebee/a4953a59257c21fc706319fadc6b9ac1 to your computer and use it in GitHub Desktop.
Save nosequeldeebee/a4953a59257c21fc706319fadc6b9ac1 to your computer and use it in GitHub Desktop.
func calculateHash(block Block) string {
record := string(block.Index) + block.Timestamp + string(block.BPM) + block.PrevHash
h := sha256.New()
h.Write([]byte(record))
hashed := h.Sum(nil)
return hex.EncodeToString(hashed)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment