
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Miller-Rabin Prime Number Determination.
A small number(~2^81) makes a definitive decision.
A large number will fallback to OpenSSL::BN::prime?
.
In order to reduce the amount of calculation, a decision is made using the minimum amount of calculation. For example, just testing on 2 will determine up to 2047. Testing on 2 and 3, gives a decision up to 1373653.
https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Testing_against_small_sets_of_bases
"if n < 3,317,044,064,679,887,385,961,981,
it is enough to test a = 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, and 41.
and the result will be deterministic."
Add this line to your application's Gemfile:
gem 'mrd_prime'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install mrd_prime
require 'mrd_prime'
small_number = (2**79 + 23)
puts( small_number.mrd_prime? ) #=> true
If you want to use the name prime?
, you can alias it.
class Integer
alias_method :prime?, :mrd_prime?
end
puts( (2**79 + 23).prime? ) #=> true
Bug reports and pull requests are welcome on GitHub at https://github.com/Matsuyanagi/mrd_prime .
FAQs
Unknown package
We found that mrd_prime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.