replace pysha3 with pycryptodome

pull/1454/head
alpharush 2 years ago
parent 440ac4b71b
commit 882fc95756
  1. 2
      setup.py
  2. 2
      slither/printers/summary/function_ids.py
  3. 8
      slither/utils/function.py

@ -13,7 +13,7 @@ setup(
python_requires=">=3.8",
install_requires=[
"prettytable>=0.7.2",
"pysha3>=1.0.2",
"pycryptodome>=3.15.0",
"crytic-compile>=0.2.4",
# "crytic-compile@git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile",
],

@ -9,7 +9,7 @@ from slither.utils.myprettytable import MyPrettyTable
class FunctionIds(AbstractPrinter):
ARGUMENT = "function-id"
HELP = "Print the keccack256 signature of the functions"
HELP = "Print the keccak256 signature of the functions"
WIKI = "https://github.com/trailofbits/slither/wiki/Printer-documentation#function-id"

@ -1,4 +1,4 @@
import sha3
from Crypto.Hash import keccak
def get_function_id(sig: str) -> int:
@ -9,6 +9,6 @@ def get_function_id(sig: str) -> int:
Return:
(int)
"""
s = sha3.keccak_256()
s.update(sig.encode("utf-8"))
return int("0x" + s.hexdigest()[:8], 16)
hash = keccak.new(digest_bits=256)
hash.update(sig.encode("utf-8"))
return int("0x" + hash.hexdigest()[:8], 16)

Loading…
Cancel
Save