package crypto import ( "github.com/vapor/common" "golang.org/x/crypto/ripemd160" "golang.org/x/crypto/sha3" ) func Sha256(data ...[]byte) []byte { d := sha3.New256() for _, b := range data { d.Write(b) } return d.Sum(nil) } func Sha256Hash(data ...[]byte) (h common.Hash) { d := sha3.New256() for _, b := range data { d.Write(b) } d.Sum(h[:0]) return h } func Ripemd160(data []byte) []byte { ripemd := ripemd160.New() ripemd.Write(data) return ripemd.Sum(nil) }