Open HarryR opened 5 years ago
The EdDSA.sol file doesn't have any tests for it, it also seems to be incompatible for the following reasons:
EdDSA.sol
JubJub.Generator()
jubjub.py
SHA256
The following code should produce valid signatures for the scheme in EdDSA.sol, but whenever I try testing in Remix it hangs the browser.
from ethsnarks.eddsa import _SignatureScheme, as_scalar from hashlib import sha256 class SHA256EdDSA(_SignatureScheme): @classmethod def hash_public(cls, R, A, M): args = [R.x.n, R.y.n, A.x.n, A.y, M] msg = b''.join([int.to_bytes(_, 32, 'big') for _ in as_scalar(*args)]) hashed_msg = sha256(msg).digest() return int.from_bytes(hashed_msg, 'big') & ((2<<249) - 1) msg = 1234 k, A = SHA256EdDSA.random_keypair() smsg = SHA256EdDSA.sign(1234, k) SHA256EdDSA.verify(A, smsg.sig, msg) args_for_contract = [A, msg, smsg.sig.R, smsg.sig.s]
The
EdDSA.sol
file doesn't have any tests for it, it also seems to be incompatible for the following reasons:JubJub.Generator()
is different compared to the one injubjub.py
SHA256
is used, but none of the implementatitons (Python, C++) use SHA256 for EdDSAThe following code should produce valid signatures for the scheme in
EdDSA.sol
, but whenever I try testing in Remix it hangs the browser.