rsa gen: cleaner stdout with carriage return. (printing to the same line)

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2020-04-17 04:40:31 +03:00
parent b2dc176d40
commit f9ff56651d
Signed by: Hesham
GPG Key ID: 74876157D199B09E

4
rsa.py
View File

@ -93,9 +93,11 @@ def getPrime(bits):
while True:
#Byte order "little" or "big" does not matter here since we want a random number from os.urandom()
x = int.from_bytes(os.urandom(int(bits/8)),"little")
print("trying: ", x)
print("trying: ", x, end="")
if isPrime(x):
print("\nprime: ", x)
return x
print("\r",end="")
def isPrime(number):