HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/rsa/__pycache__/parallel.cpython-38.pyc
U

JD�ge	�@s�dZddlZddlmZddlZddlZeedd�dd�Z	eeed�dd	�Z
d	gZed
kr�e
d�ddlZed�D]4Ze��\ZZer�q�ed
dkrrerre
de�qre
d�dS)z�Functions for parallel computation on multiple cores.

Introduced in Python-RSA 3.1.

.. note::

    Requires Python 2.6 or newer.

�N)�
Connection)�nbits�pipe�returncCs,tj�|�}tj�|�r|�|�dSqdS)N)�rsaZrandnumZread_random_odd_int�primeZis_prime�send)rr�integer�r
�9/opt/cppython/lib/python3.8/site-packages/rsa/parallel.py�_find_prime s
r)r�poolsizercsptjdd�\}�z6��fdd�t|�D�}|D]}|��q.|��}W5|�����X|D]}|��q^|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)Zduplexcsg|]}tjt��fd��qS))�target�args)�mp�Processr)�.0�_�rZ	pipe_sendr
r�
<listcomp>Aszgetprime.<locals>.<listcomp>)rZPipe�close�range�start�recv�	terminate)rr
Z	pipe_recvZprocs�p�resultr
rr�getprime*s


r�__main__z'Running doctests 1000x or until failure�d�
z%i timesz
Doctests done)�__doc__�multiprocessingrZmultiprocessing.connectionrZ	rsa.primerZrsa.randnum�intrr�__all__�__name__�print�doctestr�count�testmodZfailuresZtestsr
r
r
r�<module>s"

(