def get_e(self, mTotient): e = 1 t = 0 while ( not methods.isProbablePrime(e) and not t == 1 ): # run this loop until e is a prime, with a gcd of 1 with mTotient. e = random.randint(3, mTotient) # get random number between 3 and your mTotient t, x, y = methods.extendedEuclidianAlgorithm(e, mTotient) # Use the xEA to determine the GCD. return e
def get_private_key(self, e, mTotient): t, x, y = methods.extendedEuclidianAlgorithm(e, mTotient) d = x % mTotient return d