Better keccac256 (#41)

* Switch to keccac256 implementation from golang.org/x/crypto instead of go-ethereum
This commit is contained in:
Oleksandr Brezhniev
2021-11-19 17:00:10 +02:00
committed by GitHub
parent 9c2ca9ca7c
commit 64e757cc4a
5 changed files with 31 additions and 558 deletions

14
keccak256/keccac256.go Normal file
View File

@@ -0,0 +1,14 @@
package keccak256
import (
"golang.org/x/crypto/sha3"
)
// Hash generates a Keccak256 hash from a byte array
func Hash(data ...[]byte) []byte {
hash := sha3.NewLegacyKeccak256()
for _, d := range data {
hash.Write(d) //nolint:errcheck,gosec
}
return hash.Sum(nil)
}