def generateModulus(size, e): p = e + 1 q = e + 1 while ((p % e) == 1): p = generatePrime(size // 2) while ((q % e) == 1): q = generatePrime(size // 2) return p * q
def generateModulus(size, e): p = e+1; q = e+1; while ((p%e) == 1): p = generatePrime(size//2); while ((q%e) == 1): q = generatePrime(size//2); return p*q;
def generate_rsa_key(bits, e=65537): result = { "e" : e } p = (e+1) q = (e+1) while ((p % e) == 1): p = generatePrime(bits//2); while ((q%e) == 1): q = generatePrime(bits//2); result["p"] = p; result["q"] = q; result["N"] = p*q; result["d"] = invmod(e, (p-1)*(q-1)); return result;
def generate_rsa_key(bits, e=65537): result = {"e": e} p = (e + 1) q = (e + 1) while ((p % e) == 1): p = generatePrime(bits // 2) while ((q % e) == 1): q = generatePrime(bits // 2) result["p"] = p result["q"] = q result["N"] = p * q result["d"] = invmod(e, (p - 1) * (q - 1)) return result