示例#1
0
文件: RSA.py 项目: TiesB/pearl7
    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
示例#2
0
文件: RSA.py 项目: TiesB/pearl7
    def get_private_key(self, e, mTotient):
        t, x, y = methods.extendedEuclidianAlgorithm(e, mTotient)

        d = x % mTotient
        return d