Skip to content

Commit

Permalink
fix(deprecated): lib pysha3 has reached its end of life is no longer …
Browse files Browse the repository at this point in the history
…supported https://github.com/tiran/pysha3, change to pycryptodome
  • Loading branch information
olivmath committed Oct 31, 2023
1 parent d71e451 commit 59f6f02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions merkly/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from typing import Callable, List, Tuple
from sha3 import keccak_256
from Crypto.Hash import keccak as cryptodome_keccak
import types


Expand Down Expand Up @@ -43,7 +43,11 @@ def keccak(data: str) -> str:
"541111248b45b7a8dc3f5579f630e74cb01456ea6ac067d3f4d793245a255155"
```
"""
return keccak_256(data.encode()).hexdigest()

keccak_256 = cryptodome_keccak.new(digest_bits=256)
keccak_256.update(data.encode())

return keccak_256.hexdigest()


def half(list_item: List[int]) -> Tuple[int, int]:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ keywords = [
]

[tool.poetry.dependencies]
python = "^3.8"
pysha3 = "^1.0.2"
pycryptodome = "^3.19.0"
pydantic = "^1.10.2"
coverage = "^7.2.7"
python = "^3.8"

[tool.poetry.dev-dependencies]
conventional-pre-commit = "^2.1.1"
pre-commit = "^3.0.3"
coverage = "^7.2.7"
pyclean = "^2.2.0"
pytest = "^7.2.1"
black = "^23.1.0"
Expand Down

0 comments on commit 59f6f02

Please sign in to comment.