-
Notifications
You must be signed in to change notification settings - Fork 1
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
implement polyval #79
Conversation
deprecated or confusing code paths. In particular, tests updated for: - ghash - polyval - ghash_gfmul - hashkey_transform (used by ghash)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review LGTM! Given that main is not passing atm, I think we should go ahead and merge this polyval. This uses dramatically less constraints than the approach currently taken by ghash, so I think it's worth combining the two into one more efficient template.
// } | ||
|
||
// component MULX; | ||
// MULX = polyval_GFMULX(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach on the surface seems dramatically more efficient than the one currently used in Waylon's PR, because it only does this GFMULX once at the end.
Would be good to put our heads together and find a potentially combined approach of these code paths that is less constraint consumptive.
@@ -0,0 +1,11 @@ | |||
pragma circom 2.1.9; | |||
include "polyval_gfmul.circom"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete file, one will be merged with the other PR
@@ -22,6 +23,43 @@ template ParseLEBytes64() { | |||
out <-- temp; | |||
} | |||
|
|||
// parse BE bits as bytes and log them. Assumes that the number of bytes logged is a multiple of 8. | |||
template ParseAndLogBitsAsBytes(N_BYTES){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
out <-- ReverseByteHalves[1].out; | ||
|
||
// component Logger3 = ParseAndLogBitsAsBytes(16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -36,6 +36,13 @@ template MUL() { | |||
h[1] <== a[1]; | |||
y[0] <== b[0]; | |||
y[1] <== b[1]; | |||
// component Loggers[4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -82,52 +89,65 @@ template MUL() { | |||
BMUL64_z[i+3].y <== h_r[i]; | |||
zh[i] <== BMUL64_z[i+3].out; | |||
} | |||
// component Loggers_z[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
Xors_v[1].b <== __zh[2]; | ||
v[2] <== Xors_v[1].out; | ||
v[3] <== __zh[1]; | ||
|
||
// component Loggers_v[4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -161,6 +181,10 @@ template MUL() { | |||
XorMultiples_L[0].inputs <== [v[1], LS_v[0].out, LS_v[1].out, LS_v[2].out]; | |||
_v1 <== XorMultiples_L[0].out; | |||
|
|||
// component Loggers_v2[4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
implemented polyval to test ghash bug, rendered obsolete by waylon's recent PR, fixing ghash.
Also fixes a bug in polyval mul alg.