github.com/cryptotooltop/go-ethereum@v0.0.0-20231103184714-151d1922f3e5/crypto/codehash/codehash.go (about) 1 package codehash 2 3 import ( 4 "github.com/scroll-tech/go-ethereum/common" 5 "github.com/scroll-tech/go-ethereum/crypto" 6 "github.com/scroll-tech/go-ethereum/crypto/poseidon" 7 ) 8 9 var EmptyPoseidonCodeHash common.Hash 10 var EmptyKeccakCodeHash common.Hash 11 12 func PoseidonCodeHash(code []byte) (h common.Hash) { 13 return poseidon.CodeHash(code) 14 } 15 16 func KeccakCodeHash(code []byte) (h common.Hash) { 17 return crypto.Keccak256Hash(code) 18 } 19 20 func init() { 21 EmptyPoseidonCodeHash = poseidon.CodeHash(nil) 22 EmptyKeccakCodeHash = crypto.Keccak256Hash(nil) 23 }