crypto: make it easier to run Sha3 on multiple inputs
crypto.Sha3(append(foo, bar)) --> crypto.Sha3(foo, bar) crypto.Sha3([]byte{}) --> crypto.Sha3()
This commit is contained in:
@ -27,10 +27,11 @@ func init() {
|
||||
ecies.AddParamsForCurve(S256(), ecies.ECIES_AES128_SHA256)
|
||||
}
|
||||
|
||||
func Sha3(data []byte) []byte {
|
||||
func Sha3(data ...[]byte) []byte {
|
||||
d := sha3.NewKeccak256()
|
||||
d.Write(data)
|
||||
|
||||
for _, b := range data {
|
||||
d.Write(b)
|
||||
}
|
||||
return d.Sum(nil)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user