diff --git a/setup.py b/setup.py index 0b67d50705..e7ffc87587 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ python_requires=">=3.8", install_requires=[ "prettytable>=0.7.2", - "pysha3>=1.0.2", + "pycryptodome>=3.4.6", "crytic-compile>=0.2.4", # "crytic-compile@git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile", ], diff --git a/slither/printers/summary/function_ids.py b/slither/printers/summary/function_ids.py index 368a81382b..ca02dd7549 100644 --- a/slither/printers/summary/function_ids.py +++ b/slither/printers/summary/function_ids.py @@ -9,7 +9,7 @@ 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" diff --git a/slither/utils/function.py b/slither/utils/function.py index b86d8f4ebc..34e6f221bb 100644 --- a/slither/utils/function.py +++ b/slither/utils/function.py @@ -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) + digest = keccak.new(digest_bits=256) + digest.update(sig.encode("utf-8")) + return int("0x" + digest.hexdigest()[:8], 16)