meherett/python-hdwallet

pysha3 no longer works

pjkundert opened this issue · 3 comments

Attempting to use python-hdwallet in Python 3.11 fails, with:

× Running setup.py install for pysha3 did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      running install
      /opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x[86](https://github.com/pjkundert/python-slip39/actions/runs/3411849600/jobs/5676582611#step:4:87)_64-cpython-311
      copying sha3.py -> build/lib.linux-x86_64-cpython-311
      running build_ext
      building '_pysha3' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/Modules
      creating build/temp.linux-x86_64-cpython-311/Modules/_sha3
      gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_WITH_KECCAK=1 -I/opt/hostedtoolcache/Python/3.11.0/x64/include/python3.11 -c Modules/_sha3/sha3module.c -o build/temp.linux-x86_64-cpython-311/Modules/_sha3/sha3module.o
      In file included from Modules/_sha3/sha3module.c:20:
      Modules/_sha3/backport.inc:78:10: fatal error: pystrhex.h: No such file or directory
         78 | #include "pystrhex.h"
            |          ^~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

The pysha3 module is used only for Keccak hashing, so can be replaced by the pycrptodome modules's Crypto.Hash.keccak. I've added tests to ensure this transition results in the same hashes.

In the future, it might be possible to also eliminate the edcsa module and use pycryptodome for ECDSA as well.

Fixed in #69

Done #69

Thanks!! I updated the version from v2.1.1 to v2.1.2; any idea when you might push a new release to pypi.org/project/hdwallet, @meherett?