package hash import ( "github.com/ethereum/go-ethereum/common" "golang.org/x/crypto/sha3" ) // Keccak256 calculates and returns the Keccak256 hash of the input data. func Keccak256(data ...[]byte) []byte { d := sha3.NewLegacyKeccak256() for _, b := range data { d.Write(b) } return d.Sum(nil) } // Keccak256Hash calculates and returns the Keccak256 hash of the input data, // converting it to an internal Hash data structure. func Keccak256Hash(data ...[]byte) (h common.Hash) { d := sha3.NewLegacyKeccak256() for _, b := range data { d.Write(b) } d.Sum(h[:0]) return h }