Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify passes when it should fail #1

Open
mattcollier opened this issue Jul 12, 2017 · 5 comments
Open

verify passes when it should fail #1

mattcollier opened this issue Jul 12, 2017 · 5 comments
Assignees

Comments

@mattcollier
Copy link
Contributor

Here's the result in CI: https://ci.digitalbazaar.com/job/equihash/6/console

The test is here: https://github.com/digitalbazaar/equihash/blob/implementation/test/test.js#L75-L99

The issue can be produced with a variety of strings that are not properly Base64 encoded.

@msporny
Copy link
Member

msporny commented Jul 13, 2017

Wow, that's all sorts of bad. I'll look into it when I get some spare cycles.

@msporny
Copy link
Member

msporny commented Jul 24, 2017

I've implemented a temporary "fix" that requires inputs be the proper length (at least 128 bytes in length). That said, I have my doubts that the implementation is valid and we should check the solutions this library creates with solutions from other libraries.

@mattcollier
Copy link
Contributor Author

@msporny I was doing work in other test suites and discovered this:
https://ci.digitalbazaar.com/job/bedrock-ledger-validator-equihash/6/

I have found that if I roll back the latest commit in this module that the test will pass again.

@msporny
Copy link
Member

msporny commented Jul 27, 2017

There are two more issues with the Equihash implementation we're using that MUST be fixed before production:

  1. Inputs less than k in size automatically pass.
  2. Inputs with repeating hashes (e.g. 1, 2, 3, 42, 42, 5) automatically pass.

These bugs exist because the implementation doesn't implement some parts of the Equihash paper.

@dlongley
Copy link
Member

The solution size can be computed based on the parameters n and k; we should have a sanity check in the verify function that enforces the proper size before doing any other work to check the solution.

Other implementations address repeating hashes via a function that checks for distinct hash values for every index of the solution (i.e. equihash solution verification calls for every element in the solution to be combined with the input to produce a hash; these hashes should all be unique and ordered lexicographically).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants