aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-01-27 21:29:33 +0800
committerFelix Lange <fjl@twurst.com>2015-02-06 07:00:36 +0800
commit410b35e9135baa86e92bc07e0ef85d04e3ac0561 (patch)
treebb20aca6d2a00af533bb2d0a6c1ee0baf80bff1d /crypto/crypto.go
parent2e48d39fc7fc9b8d65e9b6e0ce6863b9374f2233 (diff)
downloadgo-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.tar
go-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.tar.gz
go-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.tar.bz2
go-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.tar.lz
go-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.tar.xz
go-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.tar.zst
go-tangerine-410b35e9135baa86e92bc07e0ef85d04e3ac0561.zip
crypto: make it easier to run Sha3 on multiple inputs
crypto.Sha3(append(foo, bar)) --> crypto.Sha3(foo, bar) crypto.Sha3([]byte{}) --> crypto.Sha3()
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r--crypto/crypto.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index d56b9112f..42e6036b5 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -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)
}