관리-도구
편집 파일: Primality.cpython-311.pyc
� O�Dgk, � � � d Z ddlmZ ddlmZ ddlmZ dZdZdd�Z d� Z dd lmZ ee dd � � � Zdd�Zd� Zd � ZdS )zHFunctions to create and test prime numbers. :undocumented: __package__ � )�Random)�Integer)� iter_range� Nc � � t | t � � st | � � } | dv rt S | � � � rt S t d� � }t | dz � � }|�t j � � j }t |� � }d}|� � � r|dz }|dz }|� � � �t |� � D ]�}d}|||fv r4t j d| dz |�� � }d|cxk r | dz k sn J �|||fv �4t ||| � � } | ||fv r�Vt d|� � D ],} t | d| � � } | |k r n| |k rt c c S �-t c S ��t S )a: Perform a Miller-Rabin primality test on an integer. The test is specified in Section C.3.1 of `FIPS PUB 186-4`__. :Parameters: candidate : integer The number to test for primality. iterations : integer The maximum number of iterations to perform before declaring a candidate a probable prime. randfunc : callable An RNG function where bases are taken from. :Returns: ``Primality.COMPOSITE`` or ``Primality.PROBABLY_PRIME``. .. __: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf �r � � � r Nr r )� min_inclusive� max_inclusive�randfunc)� isinstancer �PROBABLY_PRIME�is_even� COMPOSITEr �new�readr �random_range�pow)� candidate� iterationsr �one� minus_one�m�a�i�base�z�js �w/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Math/Primality.py�miller_rabin_testr"