github.com/0xsequence/ethkit@v1.25.0/ethcoder/keccak256.go (about) 1 package ethcoder 2 3 import ( 4 "github.com/0xsequence/ethkit/go-ethereum/common" 5 "golang.org/x/crypto/sha3" 6 ) 7 8 func Keccak256Hash(input []byte) common.Hash { 9 return common.BytesToHash(Keccak256(input)) 10 } 11 12 func Keccak256(input []byte) []byte { 13 hasher := sha3.NewLegacyKeccak256() 14 hasher.Write(input) 15 return hasher.Sum(nil) 16 } 17 18 func SHA3(input []byte) common.Hash { 19 return Keccak256Hash(input) 20 }