Example #1
0
def randomQR(n):
    return cmod.random(n)**2
Example #2
0
 def _genX(cls, p_prime, q_prime):
     maxValue = p_prime * q_prime - 1
     minValue = 2
     return cmod.integer(cmod.random(maxValue - minValue)) + minValue
 def generateParams(cls) -> PublicParams:
     rho, b, Gamma = PublicParamsBuilder._genRhoBGamma()
     g = PublicParamsBuilder._genG(Gamma, b)
     r = cmod.random(rho)
     h = g**r
     return PublicParams(Gamma, rho, g, h)
Example #4
0
 def genX(self):
     maxValue = self.p_prime * self.q_prime - 1
     minValue = 2
     return cmod.integer(cmod.random(maxValue - minValue)) + minValue
 def _genG(cls, Gamma, b):
     while True:
         gprime = cmod.random(Gamma)
         g = (gprime**b) % Gamma
         if g != 1:
             return g