Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(deps) replace pysha3 with pycryptodome #1454

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
2 changes: 1 addition & 1 deletion slither/printers/summary/function_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
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:
Expand All @@ -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)