spacemeshos / go-spacemesh

Go Implementation of the Spacemesh protocol full node. 💾⏰💪

Home Page:https://spacemesh.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reuse allocations in hashing functions

poszu opened this issue · comments

Description

Related code:

func Sum(chunks ...[]byte) (rst [32]byte) {
hh := New()
for _, chunk := range chunks {
hh.Write(chunk)
}
hh.Sum(rst[:0])
return rst
}

See https://github.com/spacemeshos/go-spacemesh/pull/5784/files/28480f57981d97fcc5a31a200cddd7136be4de66#r1553551388 for details.

Duplicate of #5850