-
Notifications
You must be signed in to change notification settings - Fork 259
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
Move common fields into ModelParameters
#365
Conversation
Hm I think you don't need to introduce a new trait; just add |
Wait, wouldn't I still need to define a trait to bound |
… trait with associated type
4fa2b5b
to
b090f46
Compare
Well I used the
On the line
|
ec/src/lib.rs
Outdated
-> Self::Projective; | ||
#[inline] | ||
fn mul<S: Into<<Self::ScalarField as PrimeField>::BigInt>>(&self, by: S) -> Self::Projective { | ||
self.mul_bits(BitIteratorBE::new(by.into())) |
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.
self.mul_bits(BitIteratorBE::new(by.into())) | |
self.mul_bits(BitIteratorBE::without_leading_zeros(by.into())) |
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.
Is this more efficient? Why isn't it the default new
implementation?
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.
It doesn't seem that this does anything in this case, because mul_bits()
calls skip_while()
anyway
You have to constrain the |
Oh I was going to change every instance of |
06d407e
to
2bf97cb
Compare
let bits = BitIteratorBE::new(by.into()); | ||
self.mul_bits(bits) | ||
} | ||
|
||
#[inline] | ||
fn mul_by_cofactor_to_projective(&self) -> Self::Projective { | ||
self.scale_by_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.
Why do they have both mul_by_cofactor_to_projective
and scale_by_cofactor
if they do the exact same thing?
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.
Update: I removed scale_by_cofactor
b0d75e2
to
c0f801e
Compare
ModelParameters
Description
In addition to some simple changes to move
COFACTOR
,COFACTOR_INV
, andis_in_correct_subgroup_assuming_on_curve()
, a new traitMultipliablePoint
had to be created because each type of curve has its ownGroupAffine
andGroupProjective
. As a result,is_in_correct_subgroup_assuming_on_curve()
now has more generic types, but fortunately if the correspondingGroupAffine
struct has an identically named function, that one does not require any generics. Because of this change, some duplicate code inec/src/models/twisted_edwards_extended.rs
was removed.closes: #326
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pending
section inCHANGELOG.md
Files changed
in the GitHub PR explorer