Add proof of fortification
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { mod_exp } from "./math.js";
|
||||
|
||||
export const KEY_SIZE = 2048;
|
||||
export const KEY_SIZE = 512;
|
||||
|
||||
export function cryptoRandom(bits) {
|
||||
if (bits === undefined) {
|
||||
@ -100,8 +100,7 @@ export function generate_prime() {
|
||||
export function generate_safe_prime() {
|
||||
while (true) {
|
||||
let n = generate_prime();
|
||||
// This does not generate safe primes! But it takes forever to find safe primes of size 1024, so this will do.
|
||||
if (small_prime_test((n - 1n) / 2n) /* && miller_rabin((n - 1n) / 2n, 40) */) {
|
||||
if (small_prime_test((n - 1n) / 2n) && miller_rabin((n - 1n) / 2n, 40)) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user