관리-도구
편집 파일: test_Primality.cpython-311.pyc
� O�Dg � � � d Z ddlZddlmZ ddlT ddlmZ ddlmZm Z m Z mZmZm Z mZ G d� dej � � Zi fd �Zed k rd� Z ej d� � � dS dS )zSelf-test for Math.Numbers� N)�list_test_cases)�*)�Integer)�PROBABLY_PRIME� COMPOSITE�miller_rabin_test� lucas_test�test_probable_prime�generate_probable_prime�generate_probable_safe_primec � � e Zd Zddddddddd d ddz dz dfZd ddddddddddddddddz dz z dfZd� Zd� Zd � Zd!� Zd"� Z d#� Z d$S )%� TestPrimality� � � � � � � � � � � lE q)8(WRv#%a��9AMo-�*7w�g�;�02wQX�@�CkE�f� �<_�f�u�f�q��sQ$c�;Q|n ?|�T��A)y�n�E�'d.(6W�-+O`'2��_��6�$�_ot`G< 8�P r � � � � � � � � � � � � � i�� �C l I1t#c � � | j D ]+}| � t |d� � t � � �,| j D ]+}| � t |d� � t � � �,| � t t dd� � d S )Nr ���)�primes�assertEqualr r � compositesr �assertRaises� ValueError)�self�prime� composites ��/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/SelfTest/Math/test_Primality.py�test_miller_rabinzTestPrimality.test_miller_rabin9 s� � ��[� J� J�E����.�u�a�8�8�.�I�I�I�I��� I� I�I����.�y�!�<�<�i�H�H�H�H����*�&7��Q�?�?�?�?�?� c � � | j D ],}t |� � }| � |t � � �-| j D ],}t |� � }| � |t � � �-| � t t d� � d S )Nr) )r* r r+ r r, r r- r. )r/ r0 �resr1 s r2 � test_lucaszTestPrimality.test_lucas@ s� � ��[� 2� 2�E��U�#�#�C����S�.�1�1�1�1��� -� -�I��Y�'�'�C����S�)�,�,�,�,����*�j�"�5�5�5�5�5r4 c �P � dddddz dz f}|D ]*}| � t |� � t � � �+d}|D ]*}| � t |� � t � � �+dd lm} |d d � D ],}t |� � }| � |t � � �-d S )Nl �������� l W3>Lk{�T�@l �� �q4}2zn�1�dY/`9��3yr i r )l �� vK +.Q�F:�yUc,$�t�c�q l !3eYlmk�E r?-�_Ve�+l �t#g�Xvn�G�;�.%yfu&1�#93Y�2:k r )� sieve_base�d )r+ r r r �Crypto.Util.numberr9 )r/ r* �p� not_primes�npr9 r6 s r2 � test_is_primezTestPrimality.test_is_primeI s� � �9�)�L��s�(�Q�,� �� � E� E�A����0��3�3�^�D�D�D�D�� � � A� A�B����0��4�4�i�@�@�@�@�1�1�1�1�1�1��D�S�D�!� 2� 2�A�%�a�(�(�C����S�.�1�1�1�1� 2� 2r4 c �v � t d�� � }| � |� � � d� � d S )Ni �� exact_bits)r r+ �size_in_bits�r/ r<