From 563778716c611570165400778dd9bfeb3d7bcb35 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Thu, 13 Feb 2025 00:38:24 +0100 Subject: [PATCH] Defalt initialize q to p, e to 0. The following loop will properly assign them. --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 56357b3..205e45c 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ int main() { enter_blink(); uint64_t p = gen_prime(1 << 15, 1 << 16); - uint64_t q = gen_prime(1 << 15, 1 << 16); + uint64_t q = p; while (p == q) p = gen_prime(1 << 15, 1 << 16); @@ -42,7 +42,7 @@ int main() { uint64_t phi_n = (p - 1) * (q - 1); // 'e' is public. E for encrypt. - uint64_t e = prand_range(3, phi_n - 1); + uint64_t e = 0; while (gcd(e, phi_n) != 1) e = prand_range(3, phi_n - 1); // 'd' is our private key. D as in decrypt