Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 8c7f9c7

Browse files
committed
exclusively use pycryptodome for sha3_256 hashing and always use version 3.3.1 or higher
1 parent 06e3c81 commit 8c7f9c7

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

ethereum/keys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
import binascii
2424
import struct
2525
from math import ceil
26-
from sha3 import sha3_256
26+
from Crypto.Hash import keccak
27+
sha3_256 = lambda x: keccak.new(digest_bits=256, data=x)
2728
from Crypto.Cipher import AES
2829
from Crypto.Hash import SHA256
2930
from Crypto.Util import Counter

ethereum/utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
try:
2-
from keccak import sha3_256 # pypy
3-
except ImportError:
4-
from sha3 import sha3_256 as _sha3_256
5-
sha3_256 = lambda x: _sha3_256(x).digest()
1+
from Crypto.Hash import keccak
2+
sha3_256 = lambda x: keccak.new(digest_bits=256, data=x).digest()
63
from bitcoin import privtopub
74
import sys
85
import rlp

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pysha3
33
PyYAML
44
repoze.lru
55
pbkdf2
6-
pycrypto
6+
pycryptodome>=3.3.1
77
scrypt
88
https://github.com/ethereum/pyrlp/tarball/develop
99
https://github.com/ethereum/ethash/tarball/master

0 commit comments

Comments
 (0)