You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
It seems that the interface for keccak provided by Crypto.Hash.keccak isn't compatible with pysha3, it doesn't seem to allow you to pass-in data to be hashed as part of the constructor.
As per the documentation the keccak.new function should accept the data kwarg, however it doesn't accept it as the first parameter which would be compatible with the Python hashlib standard interface and pysha3.
ERROR: test_miximus (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_miximus
Traceback (most recent call last):
File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
module = self._get_module_from_name(name)
File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/home/fnatic/ethsnarks-miximus/python/test/test_miximus.py", line 4, in <module>
from ethsnarks.mimc import mimc_hash
File "/home/fnatic/ethsnarks-miximus/ethsnarks/ethsnarks/mimc.py", line 38, in <module>
assert H(123) == 38632140595220392354280998614525578145353818029287874088356304829962854601866
File "/home/fnatic/ethsnarks-miximus/ethsnarks/ethsnarks/mimc.py", line 35, in H
hashed = keccak_256(data).digest()
File "/home/fnatic/ethsnarks-miximus/ethsnarks/ethsnarks/mimc.py", line 10, in <lambda>
keccak_256 = lambda *args: keccak.new(*args, digest_bits=256)
TypeError: new() takes 0 positional arguments but 1 was given
I tried to make Crypto.Hash.keccak available as a fallback when
pysha3
isn't installed.However, one person ran into an issue: HarryR/ethsnarks-miximus#4 (comment)
It seems that the interface for
keccak
provided by Crypto.Hash.keccak isn't compatible withpysha3
, it doesn't seem to allow you to pass-in data to be hashed as part of the constructor.As per the documentation the
keccak.new
function should accept thedata
kwarg, however it doesn't accept it as the first parameter which would be compatible with the Pythonhashlib
standard interface andpysha3
.Offending code from: https://github.com/HarryR/ethsnarks/blob/master/ethsnarks/mimc.py
Error:
Suggested fix:
Documentation: https://pycryptodome.readthedocs.io/en/latest/src/hash/keccak.html
Example usage:
The text was updated successfully, but these errors were encountered: