github.com/chain5j/chain5j-pkg@v1.0.7/crypto/hashalg/sha3/keccak.go (about) 1 // Package sha3 2 // 3 // @author: xwc1125 4 package sha3 5 6 // Keccak256 calculates and returns the Keccak256 hash of the input data. 7 func Keccak256(data ...[]byte) []byte { 8 d := NewKeccak256() 9 for _, b := range data { 10 d.Write(b) 11 } 12 return d.Sum(nil) 13 } 14 15 // Keccak512 calculates and returns the Keccak512 hash of the input data. 16 func Keccak512(data ...[]byte) []byte { 17 d := NewKeccak512() 18 for _, b := range data { 19 d.Write(b) 20 } 21 return d.Sum(nil) 22 }