term-output #4
11
rsa.py
11
rsa.py
@ -165,11 +165,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)), byteOrder)
|
x = int.from_bytes(os.urandom(int(bits/8)), byteOrder)
|
||||||
print("trying: ", x, end="")
|
print(x, end="")
|
||||||
if mr.is_prime(x):
|
if mr.is_prime(x):
|
||||||
print("\nprime: ", x)
|
print("\nprime: ", x)
|
||||||
return x
|
return x
|
||||||
print("\r",end="")
|
backTrack(x)
|
||||||
|
|
||||||
|
|
||||||
def isPrime(number):
|
def isPrime(number):
|
||||||
@ -339,5 +339,12 @@ def printHelp():
|
|||||||
print("rsa print <key>")
|
print("rsa print <key>")
|
||||||
print("rsa list")
|
print("rsa list")
|
||||||
|
|
||||||
|
def backTrack(x):
|
||||||
|
#Back track and clear terminal with length of x
|
||||||
|
length = len(str(x))
|
||||||
|
while length > 0:
|
||||||
|
print("\b",end="")
|
||||||
|
length -= 1
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user