What is miller-rabin?
The miller-rabin npm package is a JavaScript implementation of the Miller-Rabin probabilistic primality test. This package is used to determine whether a given number is a probable prime. It is particularly useful in cryptographic applications where large prime numbers are required.
What are miller-rabin's main functionalities?
Primality Testing
This feature allows users to test if a number is a probable prime using the Miller-Rabin test. The example shows how to test if the number 17 is a probable prime.
const MillerRabin = require('miller-rabin');
const mr = new MillerRabin();
const probablePrime = mr.test(BigInt(17));
console.log(probablePrime); // outputs true
Other packages similar to miller-rabin
bignum
The 'bignum' package provides arbitrary-precision arithmetic operations, including primality testing. It offers similar functionality for primality testing but also includes a broader range of arithmetic operations, making it more versatile than miller-rabin.
prime-number
The 'prime-number' package is another tool for checking the primality of numbers. Unlike miller-rabin, which uses a probabilistic test, 'prime-number' uses deterministic tests for smaller numbers and switches to probabilistic tests for larger numbers, potentially offering a different balance of performance and accuracy.
Miller-Rabin
LICENSE
This software is licensed under the MIT License.
Copyright Fedor Indutny, 2014.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.