Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

crypto-random-prime

fabiospampinato7kMIT1.0.1TypeScript support: included

Generate a cryptographically-random probable prime number that passes the Miller-Rabin test with the given number of bits of entropy.

random, prime, number, generator

readme

Crypto Random Prime

Generate a cryptographically-random probable prime number that passes the Miller-Rabin test with the given number of bits of entropy.

Install

npm install crypto-random-prime

Usage

import random from 'crypto-random-prime';

// Let's generate a 300-bits random prime, performing 64 rounds of Miller-Rabin tests

random ( 300, 64 ); // => 1229897812185405005544550995303702949862219513844036076668441860571526838822977324092558451n

License

MIT © Fabio Spampinato