;i dZddlZddlmZddlZddlZdededdfdZ dededefd Z d gZ e d krYe d ddlZed D]1Zej\ZZernedzdkrere dez2e ddSdS)zFunctions for parallel computation on multiple cores. Introduced in Python-RSA 3.1. .. note:: Requires Python 2.6 or newer. N) Connectionnbitspipereturnc tj|}tj|r||dSV)N)rsarandnumread_random_odd_intprimeis_primesend)rrintegers @C:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\rsa/parallel.py _find_primer sR+11%88 9  g & &  IIg    F poolsizectjd\} fdt|D}|D]}||}|n-#|wxYw|D]}||S)aUReturns a prime number that can be stored in 'nbits' bits. Works in multiple threads at the same time. >>> p = getprime(128, 3) >>> rsa.prime.is_prime(p-1) False >>> rsa.prime.is_prime(p) True >>> rsa.prime.is_prime(p+1) False >>> from rsa import common >>> common.bit_size(p) == 128 True F)duplexcJg|]}tjtf S))targetargs)mpProcessr).0_r pipe_sends r zgetprime..As-bbbQ;eY5GHHHbbbr)rPiperangestartrecvclose terminate)rr pipe_recvprocspresultrs` @rgetprimer(*s& WE222Y  bbbbbRWX`RaRabbb  A GGIIII!!  Ms A B*B8r(__main__z'Running doctests 1000x or until failured z%i timesz Doctests done)__doc__multiprocessingrmultiprocessing.connectionr rsa.primer rsa.randnumintrr(__all____name__printdoctestrcounttestmodfailurestestsrrr;sE111111s*%C%3%3%%%%P , z E 3444NNNs&&+GO--5   E 2:??u? E*u$ % % % E/r