ConsenSysMesh / ens-namehash-py

A python implementation of the namehash algorithm from EIP137

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong sha3 ?

TallJanSmit opened this issue · comments

I am guessing it is due to usage of pysha3-1.0.2 rather than pysha3==0.3 (as I read in requirements.txt), but to get namehash to work properly I changed line 4 as follows:

from sha3 import keccak_256 as sha3_256

Not sure why sha3_256 and keccak_256 differ though

@TallJanSmit you are a hero without a cape.

The requirements are

pyhsa >= 0.3 < 1.0.0

I think that from python 3.6 the pysha3 versions are greater than 1.0.0, so, for example, i tried the examples of the Readme and found this:

  File "test.py", line 1, in <module>
    from namehash import namehash
  File "/home/marcos/sandbox/venv/lib/python3.6/site-packages/namehash.py", line 24, in <module>
    assert codecs.encode(sha3(b''), 'hex') == b'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'  # noqa
AssertionError

I guess there was a breaking modification on the codecs package or sha3 implementation

Is there any way to remove this assertion and make it work properly out of the box? Have the same issue.