Skip to content

Commit 54c3db0

Browse files
committed
chore: remove console.log
1 parent 562f844 commit 54c3db0

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

prime.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function randomBigInt(range: bigint): bigint {
2727

2828
// https://github.com/openssl/openssl/blob/4cedf30e995f9789cf6bb103e248d33285a84067/crypto/bn/bn_prime.c#L337
2929
export function isPrimeMillerRabin(w: bigint, iterations?: number): boolean {
30-
// console.log("isprime", w);
3130
if (w === 2n) {
3231
return true;
3332
}
@@ -53,21 +52,17 @@ export function isPrimeMillerRabin(w: bigint, iterations?: number): boolean {
5352
// (Step 4)
5453
outer_loop:
5554
for (let i = 0; i < iterations; i++) {
56-
// console.log("iter", i);
5755
// (Step 4.1) obtain a Random string of bits b where 1 < b < w-1 */
5856
const b = randomBigInt(w3) + 2n;
59-
// console.log("step 4.1");
6057

6158
// (Step 4.5) z = b^m mod w
6259
// in openssl, Montgomery modular multiplication (TODO)
63-
// console.log("step 4.5", b, m, w);
6460
let z = modPow(b, m, w);
6561

6662
/* (Step 4.6) if (z = 1 or z = w-1) */
6763
if (z === 1n || z === w1) {
6864
continue outer_loop;
6965
}
70-
// console.log("step 4.7", a);
7166
/* (Step 4.7) for j = 1 to a-1 */
7267
for (let j = 1; j < a; j++) {
7368
// (Step 4.7.1 - 4.7.2) x = z, z = x^2 mod w
@@ -96,7 +91,6 @@ function randomOdd(bits: number): bigint {
9691
}
9792

9893
export function randomPrime(bits: number): bigint {
99-
// console.log("random", bits);
10094
if (bits < 2) {
10195
return 1n;
10296
}

0 commit comments

Comments
 (0)