Debian Codegraph @

debian/patches/pycryptodomex

raw
1 From: Timothy Redaelli <[email protected]>
2 Date: Mon, 17 Oct 2022 14:59:47 +0200
3 Subject: Replace pysha3 with pycryptodomex
4
5 pysha3 is not maintained anymore and it doesn't build correctly with
6 Python 3.11 so replace it with pycryptodomex that is still maintained and
7 working correctly with new python versions
8
9 Origin: https://github.com/opentimestamps/python-opentimestamps/pull/47
10 ---
11 opentimestamps/core/op.py | 4 ++--
12 requirements.txt | 2 +-
13 setup.py | 2 +-
14 3 files changed, 4 insertions(+), 4 deletions(-)
15
16 diff --git a/opentimestamps/core/op.py b/opentimestamps/core/op.py
17 index b67a2b7..29f2e86 100644
18 --- a/opentimestamps/core/op.py
19 +++ b/opentimestamps/core/op.py
20 @@ -10,8 +10,8 @@
21 # in the LICENSE file.
22
23 import binascii
24 +import Cryptodome.Hash.keccak
25 import hashlib
26 -import sha3
27 import opentimestamps.core.serialize
28
29 class MsgValueError(ValueError):
30 @@ -344,6 +344,6 @@ class OpKECCAK256(UnaryOp):
31 DIGEST_LENGTH = 32
32
33 def _do_op_call(self, msg):
34 - r = sha3.keccak_256(bytes(msg)).digest()
35 + r = Cryptodome.Hash.keccak.new(digest_bits=256, data=bytes(msg)).digest()
36 assert len(r) == self.DIGEST_LENGTH
37 return r
38 diff --git a/requirements.txt b/requirements.txt
39 index 278ef7b..835eea6 100644
40 --- a/requirements.txt
41 +++ b/requirements.txt
42 @@ -1,3 +1,3 @@
43 python-bitcoinlib>=0.9.0,<0.12.0
44 GitPython>=2.0.8
45 -pysha3>=1.0.2
46 +pycryptodomex>=3.3.1
47 diff --git a/setup.py b/setup.py
48 index 1802f9e..cda6aa7 100644
49 --- a/setup.py
50 +++ b/setup.py
51 @@ -70,7 +70,7 @@ setup(
52 # requirements files see:
53 # https://packaging.python.org/en/latest/requirements.html
54 install_requires=['python-bitcoinlib>=0.9.0,<0.12.0',
55 - 'pysha3>=1.0.2'],
56 + 'pycryptodomex>=3.3.1'],
57
58 # List additional groups of dependencies here (e.g. development
59 # dependencies). You can install these using the following syntax,