Skip to content

Commit

Permalink
Merge pull request #1454 from crytic/pycryptodome
Browse files Browse the repository at this point in the history
(deps) replace pysha3 with pycryptodome
  • Loading branch information
montyly authored Nov 14, 2022
2 parents 440ac4b + 99c973d commit 880f5a4
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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",
],
2 changes: 1 addition & 1 deletion slither/printers/summary/function_ids.py
Original file line number Diff line number Diff line change
@@ -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"

8 changes: 4 additions & 4 deletions slither/utils/function.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 880f5a4

Please sign in to comment.