diff --git a/rsa.py b/rsa.py
index 734ff8d..30af0ba 100755
--- a/rsa.py
+++ b/rsa.py
@@ -118,6 +118,12 @@ def main():
if sys.argv[1] == "is_prime_mr" and len(sys.argv) == 4: #rsa is_prime_mr
isPrime_cmd(1)
sys.exit(0)
+ if sys.argv[1] == "genrand" and len(sys.argv) == 3: #rsa genrand
+ print(gen_random(int(sys.argv[2])))
+ sys.exit(0)
+ if sys.argv[1] == "genprime" and len(sys.argv) == 3: #rsa genprime
+ print(getPrime(int(sys.argv[2])))
+ sys.exit(0)
if sys.argv[1] == "print" and len(sys.argv) == 3: #rsa print
printKey(readKeyFile(sys.argv[2]))
sys.exit(0)
@@ -190,9 +196,9 @@ def getPrime(bits):
x = int.from_bytes(os.urandom(int(bits/8)), byteOrder)
print('Trying: ', x, end="\n")
if mr.is_prime(x):
- print("\nprime: ", x)
+ print("\nprime: ", x, '\n')
return x
- backTrack(x)
+ #backTrack(x)
def isPrime(number):
@@ -217,6 +223,10 @@ def isPrime(number):
return False
return True
+def gen_random(bits: int):
+ x = int.from_bytes(os.urandom(int(bits/8)), byteOrder)
+ return x
+
def sign(encrypted_msg, key):
enc_msg = str(encrypted_msg)
encrypted_msg_list = enc_msg.split()