From a8f91fe50af5468de4a2eb3d6a024784b81a9c91 Mon Sep 17 00:00:00 2001 From: Agost Biro Date: Wed, 5 Jun 2024 22:48:49 +0200 Subject: [PATCH] Reduce prime check iterations to 1 --- crates/vdf/src/create_discriminant.rs | 2 +- crates/vdf/src/proof_wesolowski.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vdf/src/create_discriminant.rs b/crates/vdf/src/create_discriminant.rs index 6824100..4b10225 100644 --- a/crates/vdf/src/create_discriminant.rs +++ b/crates/vdf/src/create_discriminant.rs @@ -112,7 +112,7 @@ pub fn create_discriminant(seed: &[u8], length: u16) -> T { if !x { let q = u64::from(M) * u64::from(i as u32); n = n + q; - if n.probab_prime(2) { + if n.probab_prime(1) { return -n; } n = n - q; diff --git a/crates/vdf/src/proof_wesolowski.rs b/crates/vdf/src/proof_wesolowski.rs index d4f46a3..8f867a3 100644 --- a/crates/vdf/src/proof_wesolowski.rs +++ b/crates/vdf/src/proof_wesolowski.rs @@ -119,7 +119,7 @@ fn hash_prime(seed: &[&[u8]]) -> T { hasher.input(i); } let n = T::from(&hasher.fixed_result()[..16]); - if n.probab_prime(2) { + if n.probab_prime(1) { break n; } j += 1;