rsa gen: cleaner stdout with carriage return. (printing to the same line)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
b2dc176d40
commit
f9ff56651d
4
rsa.py
4
rsa.py
@ -93,9 +93,11 @@ def getPrime(bits):
|
|||||||
while True:
|
while True:
|
||||||
#Byte order "little" or "big" does not matter here since we want a random number from os.urandom()
|
#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")
|
x = int.from_bytes(os.urandom(int(bits/8)),"little")
|
||||||
print("trying: ", x)
|
print("trying: ", x, end="")
|
||||||
if isPrime(x):
|
if isPrime(x):
|
||||||
|
print("\nprime: ", x)
|
||||||
return x
|
return x
|
||||||
|
print("\r",end="")
|
||||||
|
|
||||||
|
|
||||||
def isPrime(number):
|
def isPrime(number):
|
||||||
|
Loading…
Reference in New Issue
Block a user