-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow custom MSB setting in generated primes #69
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #69 +/- ##
==========================================
+ Coverage 99.44% 99.46% +0.01%
==========================================
Files 10 10
Lines 1449 1491 +42
==========================================
+ Hits 1441 1483 +42
Misses 8 8 ☔ View full report in Codecov by Sentry. |
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 so far
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.
Sure, we can get this in first. |
In the RSA application one needs two primes which, when multiplied, produce a number with a fixed bit length. This can be achieved by requiring two most significant bits to be set on each. The current code just sets the MSB by default, and setting the second one requires writing a custom wrapper over
SmallPrimesSieveFactory
.This PR attempts to provide a simpler pathway for most common bit-setting cases: no bits set (primes generated up to the chosen bit length), MSB set, and two MSBs set.
random_odd_uint()
andSmallPrimesSieveFactory
constructors get an additionalSetBits
parameter.An RSA application would have to use the new functionality by calling
The default currently remains
SetBits::Msb
, but perhaps it should be changed toSetBits::None
.