File: pycryptodomex

package info (click to toggle)
python-opentimestamps 0.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 340 kB
  • sloc: python: 1,764; sh: 16; makefile: 4
file content (57 lines) | stat: -rw-r--r-- 1,872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From: Timothy Redaelli <timothy.redaelli@gmail.com>
Date: Mon, 17 Oct 2022 14:59:47 +0200
Subject: Replace pysha3 with pycryptodomex

pysha3 is not maintained anymore and it doesn't build correctly with
Python 3.11 so replace it with pycryptodomex that is still maintained and
working correctly with new python versions
---
 opentimestamps/core/op.py | 4 ++--
 requirements.txt          | 2 +-
 setup.py                  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/opentimestamps/core/op.py b/opentimestamps/core/op.py
index b67a2b7..29f2e86 100644
--- a/opentimestamps/core/op.py
+++ b/opentimestamps/core/op.py
@@ -10,8 +10,8 @@
 # in the LICENSE file.
 
 import binascii
+import Cryptodome.Hash.keccak
 import hashlib
-import sha3
 import opentimestamps.core.serialize
 
 class MsgValueError(ValueError):
@@ -344,6 +344,6 @@ class OpKECCAK256(UnaryOp):
     DIGEST_LENGTH = 32
 
     def _do_op_call(self, msg):
-        r = sha3.keccak_256(bytes(msg)).digest()
+        r = Cryptodome.Hash.keccak.new(digest_bits=256, data=bytes(msg)).digest()
         assert len(r) == self.DIGEST_LENGTH
         return r
diff --git a/requirements.txt b/requirements.txt
index 278ef7b..835eea6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 python-bitcoinlib>=0.9.0,<0.12.0
 GitPython>=2.0.8
-pysha3>=1.0.2
+pycryptodomex>=3.3.1
diff --git a/setup.py b/setup.py
index 1802f9e..cda6aa7 100644
--- a/setup.py
+++ b/setup.py
@@ -70,7 +70,7 @@ setup(
     # requirements files see:
     # https://packaging.python.org/en/latest/requirements.html
     install_requires=['python-bitcoinlib>=0.9.0,<0.12.0',
-                      'pysha3>=1.0.2'],
+                      'pycryptodomex>=3.3.1'],
 
     # List additional groups of dependencies here (e.g. development
     # dependencies). You can install these using the following syntax,