Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
quick-is-prime
Advanced tools
Test if a number is prime in constant time, using a cached Sieve of Eratosthenes.
Test if a number is prime in constant time, using a cached Sieve of Eratosthenes. This is especially helpful to test many numbers' primality.
$ npm install quick-is-prime
var isPrime = require('quick-is-prime');
// Simple examples
console.log(isPrime(47)); // true
console.log(isPrime(48)); // false
console.log(isPrime(61)); // true
console.log(isPrime(100)); // false
// More challenging examples
console.log(isPrime(9998903)) // true, only takes 1.5 seconds
console.log(isPrime(9893899)) // true, adds no extra calculation time
This module uses a cached Sieve of Eratosthenes for constant time lookup. A new one will be automatically generated if the number you're testing is larger than the currently cached sieve's upper bound.
For best results, check primes highest to lowest. Or alternatively, if you know what the upper bound will be, just check that first to not be concerned with the order.
FAQs
Test if a number is prime in constant time, using a cached Sieve of Eratosthenes.
The npm package quick-is-prime receives a total of 26 weekly downloads. As such, quick-is-prime popularity was classified as not popular.
We found that quick-is-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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.