-
Notifications
You must be signed in to change notification settings - Fork 129
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
🐞 Create Sample Data for 1.0.0 Preview #261
Comments
This sample data seems to have problems with hashing. In particular, it appears that hash checks in Spec Steps 2, 3, 4, 5, and 8 fail. What's odd is the hash check in Step 9 succeeds. Here is the output from the MITRE verifier omitting the spoiled verifier checks. I studied my code and I could see no mistakes, but the problem could be with me. Something doesn't add up.
|
For hashing, the verifier takes the output of SHA-256, interprets it as an integer and reduces it modulo q-1. This is in line 47 of Hash.jl here: https://github.com/mitre/ElectionGuardVerifier.jl/blob/2f8ac2ab83e5225dbaf8ba90a373c8f08923ba03/src/Hash.jl#L47 But ElectionGuard takes these values modulo q and not modulo q-1. See here in the python code for example: This has not been a problem with the previous data because the v0.95 hamilton-general data set uses the standard parameters where q = 2^256-189. This means that the reduction never actually does anything, not modulo q and not modulo q-1, because a SHA-256 output gives an integer in [0, 2^256-1] and the chance for it to be larger than or equal to q are vanishingly small. But the 1.0.0-preview-1 data set uses parameters where q = 2^16-15. So, every SHA-256 output is actually reduced modulo q-1, which is different from the mod q value. This may be the problem. |
Changing the hash modulus from q-1 to q fixes the problem for the preview sample data. It also makes no difference to the output for the 0.95.0 sample data. The problem is fixed. I have no idea why I used q-1. I derived my code from the Python code, so I'm not sure what happened. In any event, the draft spec is correct. |
I see what happened. The modulus in the Python code was changed in commit f913f35e466b6f66c63cbcdc1c4912818b5292dd on February 9th and I missed the change. |
Is there an existing issue for this?
Current Behavior
Existing Data displayed is currently the 0.95 data not the 1.0 preview data.
https://github.com/microsoft/electionguard/tree/main/data/1.0.0-preview-1/sample/hamilton-general
Expected Behavior
No response
Steps To Reproduce
No response
Environment
- OS:
Anything else?
No response
The text was updated successfully, but these errors were encountered: