mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 18:21:20 +00:00
16 lines
367 B
Go
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
|
|
}
|