prysm-pulse/shared/hashutil/hash.go
2018-10-13 21:32:29 -05:00

16 lines
367 B
Go

package hashutil
import (
"golang.org/x/crypto/blake2b"
)
// Hash defines a function that returns the
// blake2b hash of the data passed in.
// https://github.com/ethereum/eth2.0-specs/blob/master/specs/beacon-chain.md#appendix-a---hash-function
func Hash(data []byte) [32]byte {
var hash [32]byte
h := blake2b.Sum512(data)
copy(hash[:], h[:32])
return hash
}