Skip to content

Commit

Permalink
remove dependency of iden3 package from jrpc (#1596)
Browse files Browse the repository at this point in the history
  • Loading branch information
tclemos authored Jan 27, 2023
1 parent c224bb5 commit a4f1649
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jsonrpc/endpoints_web3.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jsonrpc
import (
"math/big"

"github.com/iden3/go-iden3-crypto/keccak256"
"golang.org/x/crypto/sha3"
)

// Web3Endpoints contains implementations for the "web3" RPC endpoints
Expand All @@ -18,5 +18,8 @@ func (e *Web3Endpoints) ClientVersion() (interface{}, rpcError) {
// Sha3 returns the keccak256 hash of the given data.
func (e *Web3Endpoints) Sha3(data argBig) (interface{}, rpcError) {
b := (*big.Int)(&data)
return argBytes(keccak256.Hash(b.Bytes())), nil
hash := sha3.NewLegacyKeccak256()
hash.Write(b.Bytes()) //nolint:errcheck,gosec
keccak256Hash := hash.Sum(nil)
return argBytes(keccak256Hash), nil
}

0 comments on commit a4f1649

Please sign in to comment.