Example #1
0
 def paramgen(self, secparam):
     while True:
         p, q = randomPrime(secparam), randomPrime(secparam)
         if isPrime(p) and isPrime(q):
             N = p * q
             phi_N = (p - 1) * (q - 1)
             break
     return (p, q, N, phi_N)
Example #2
0
 def paramgen(self, secparam):
     while True:
         p, q = randomPrime(secparam), randomPrime(secparam)
         if isPrime(p) and isPrime(q):
             N = p * q
             phi_N = (p - 1) * (q - 1)
             break
     return (p, q, N, phi_N)
Example #3
0
    def paramgen(self, secparam):
        while True:
            p = randomPrime(secparam)
            if isPrime(p) and (((p-3)%4) == 0):
                break
        while True:
            q = randomPrime(secparam)
            if isPrime(q) and (((q-3)%4) == 0) and not(q == p):
                break
        N = p * q
        yp = (p % q) ** -1
        yq = (q % p) ** -1

        return (p, yp, q, yq, N)