-
Notifications
You must be signed in to change notification settings - Fork 188
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
Add clear_cofactor. #18
Conversation
ff7ef29
to
e5777cb
Compare
Thanks! As remarked in the recent BLS12-381 hashing paper, for G1 you can just multiply by |
I think a "multiply by x" method should be made since I think you can build everything on top of that method (even the multiplication by x^2 - x - 1, using Horner's rule.) The "multiply by x" method can call the double method directly as needed, so you can avoid using |
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.
Here's a nice point in the Jacobian with nontrivial Z-coordinate. It has all torsion components.
x = 350898114783857325927094128797824245304332326695197644670817064152147218046382658891659391253935977554749163039309*u + 1942754808117291816143999833892557460183300072014507344900746720185664302954222967967024873214934378647278006268833
y = 3088704814004870030528824518395462854568730512980615222311538832067684268838353942640261277389143006135178816895355*u + 3899650597351899360349258896995920865499279578127773928753636067070462033619448741202620179159122308793599703155804
z = 2134816543916995720562686544050099617875819220457026417152635513766956164039125702682165220413578798936075993043249*u + 1106895829710730856658424812785614944981939716636035738306633804301486234264494172392187662811280865021721915588505
Let's use this in tests instead.
src/g1.rs
Outdated
#[test] | ||
fn test_clear_cofactor() { | ||
// the generator (and the identity) are always on the curve, | ||
// even after clearning the cofactor |
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.
nit: clearning -> clearing
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.
The typo is still here.
1e664d1
to
fd382dc
Compare
Hey, thank you so much for the fast review!
|
Just for the record, on G2 I used the point you gave me. I converted it to the Montgomery representation via:
while for G1 I took a random point and a random scalar via:
|
18cbf1c
to
7dc6f31
Compare
In g1, we use https://ia.cr/2019/403, section 5. In g2, we use https://ia.cr/2017/419, section 4.1.
I'll open some issues about adding similar methods to |
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.
utACK. I did not verify the correctness of psi_coeff_x
, psi_coeff_y
, or psi2_coeff_x
.
src/g1.rs
Outdated
#[test] | ||
fn test_clear_cofactor() { | ||
// the generator (and the identity) are always on the curve, | ||
// even after clearning the cofactor |
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.
The typo is still here.
Thank you @mmaker! |
Hmm, could you please mention me once you do?
Ugh, sorry… Thanks a lot for your kind help! |
In g1, simply multiply by the cofactor.
In g2, we use Budroni-Pintore.