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

View File

@@ -5,16 +5,16 @@ import (
"math/big"
"testing"
"github.com/ethereum/go-ethereum/crypto"
"github.com/iden3/go-iden3-crypto/keccak256"
"github.com/stretchr/testify/assert"
)
func TestKeccak256(t *testing.T) {
res := crypto.Keccak256([]byte(SEED))
res := keccak256.Hash([]byte(SEED))
assert.Equal(t,
"b6e489e6b37224a50bebfddbe7d89fa8fdcaa84304a70bd13f79b5d9f7951e9e",
hex.EncodeToString(res))
c := new(big.Int).SetBytes(crypto.Keccak256([]byte(SEED)))
c := new(big.Int).SetBytes(keccak256.Hash([]byte(SEED)))
assert.Equal(t,
"82724731331859054037315113496710413141112897654334566532528783843265082629790",
c.String())