Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function genKey(bits) {
assert((bits >>> 0) === bits);
assert(bits === 2048 || bits === 4096);
const primes = [primes1024, primes2048][bits >>> 12];
for (;;) {
const i = rng.randomRange(0, primes.length);
const j = rng.randomRange(0, primes.length);
if (i === j)
continue;
const p = BN.decode(primes[i]);
const q = BN.decode(primes[j]);
const n = p.mul(q);
const pm1 = p.subn(1);
const qm1 = q.subn(1);
const phi = pm1.mul(qm1);
let e = null;
let d = null;
for (let i = 1; i < smallPrimes.length; i++) {
try {
function genKey(bits) {
assert((bits >>> 0) === bits);
assert(bits === 2048 || bits === 4096);
const primes = [primes1024, primes2048][bits >>> 12];
for (;;) {
const i = rng.randomRange(0, primes.length);
const j = rng.randomRange(0, primes.length);
if (i === j)
continue;
const p = BN.decode(primes[i]);
const q = BN.decode(primes[j]);
const n = p.mul(q);
const pm1 = p.subn(1);
const qm1 = q.subn(1);
const phi = pm1.mul(qm1);
let e = null;
let d = null;
for (let i = 1; i < smallPrimes.length; i++) {
getAddress() {
if (this.addresses.length === 0)
return new Address();
return this.addresses[rng.randomRange(0, this.addresses.length)];
}
function rand(num) {
return rng.randomRange(0, num);
}
function random(max) {
return rng.randomRange(0, max);
}
function random(max) {
return rng.randomRange(0, max);
}