From 4cea17e9e9993ebe8233d64a14ab5d0a5324516a Mon Sep 17 00:00:00 2001 From: Alex Yekyk <53392233+ayekyk@users.noreply.github.com> Date: Sun, 20 Oct 2019 11:59:14 +0000 Subject: [PATCH] Optimized find_prime --- elgamal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elgamal.py b/elgamal.py index 7d2aee4..690996a 100644 --- a/elgamal.py +++ b/elgamal.py @@ -194,7 +194,7 @@ def find_prime(iNumBits, iConfidence): p = random.randint(2**(iNumBits-2),2**(iNumBits-1)) #keep doing this if the solovay-strassen test fails - while( not SS(p, iConfidence) ): + while( not SS(p * 2 + 1, iConfidence) ): p = random.randint( 2**(iNumBits-2), 2**(iNumBits-1) ) while( p % 2 == 0 ): p = random.randint(2**(iNumBits-2), 2**(iNumBits-1))