Merge pull request #1454 from crytic/pycryptodome

(deps) replace pysha3 with pycryptodome
pull/1470/head
Feist Josselin 2 years ago committed by GitHub
commit 880f5a45ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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.4.6",
"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)
digest = keccak.new(digest_bits=256)
digest.update(sig.encode("utf-8"))
return int("0x" + digest.hexdigest()[:8], 16)

Loading…
Cancel
Save