%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/lib64/python2.7/site-packages/Crypto/SelfTest/Util/
Upload File :
Create Path :
Current File : //proc/self/root/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyc

�
Bd\Rc@s�dZdZddlZejddkrKejddkrKddlTnddlZdejfd	��YZid
�Ze	dkr�d�Z
ejd
d�ndS(s+Self-tests for (some of) Crypto.Util.numbers$Id$i����Niii(t*t	MiscTestscBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCs ddlmaddladS(Ni����(tnumber(tCrypto.UtilRtmath(tself((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pytsetUp'scCs�|jttjdd�|jttjdd�|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjd	d��|jdtjd
d��|jdtjdd��x�tddd�D]x}|jdtjd|��d
}xM|d|dkr�t|dd|�\}}|t|�}|j|d||f|d|tj|d|�f�t|d|�\}}|t|�}|j|||f||tj||�f�t|dd|�\}}|t|�}|j|d||f|d|tj|d|�f�|d9}qhWq=WdS(sUtil.number.ceil_shifti����iiiiiiiiii	i�llNi�(tassertRaisestAssertionErrorRt
ceil_shifttassertEqualtrangetdivmodtint(Rtbtntqtrtexpected((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyttest_ceil_shift,sJ$$cCs�|jttjdd�|jttjdd�|jttjdd�|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjd	d��|jdtjd
d��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjd	d��|jdtjd
d��|jdtjdd��|jdtjdd��|jdtjdd	��|jdtjdd	��|jdtjdd	��|jdtjdd	��|jdtjd	d	��|jdtjd
d	��|jdtjdd	��|jdtjdd	��|jdtjd
d	��|jdtjdd	��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jdtjd	d��|jdtjd
d��|jdtjdd��|jdtjdd��|jdtjd
d��|jdtjdd��dS(sUtil.number.ceil_divt1iii����i����ii����iiiiiii	i����i����i����i����i����i����N(Rt	TypeErrorRtceil_divtZeroDivisionErrorR
(R((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyt
test_ceil_div_slcCs�|jttjd�|jttjd�|jttjd�|jdtjd��|jdtjd��|jttjd�|jdtjd��|jttjd�|jttjd	�|jttjd
�d}d}xs|dkrf|d|krC|j|tj|�d
||f�|d7}n|jttj|�|d7}q�Wxstddd�D]_}|jttjd|d�|j|tjd|��|jttjd|d�qzWdS(sUtil.number.exact_log2t0i����iiiiiiiiiisexpected=2**%d, n=%di@lNiA(RRRt
exact_log2t
ValueErrorR
R(RteR((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyttest_exact_log2�s,&
cCs�|jdtjdd��|jttjdd�|jdtjdd��|jttjdd�|jdtjdd��|jdtjdd��|jdtjdd��|jttjdd�|jdtjdd��|jdtjdd��|jdtjdd��|jdtjdd��|jttjdd�|jttjdd�|jdtjddd	t��|jttjddd	t�d
S(sUtil.number.exact_diviiiii����i����i����it
allow_divzeroN(R
Rt	exact_divRRRtTrue(R((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyttest_exact_div�s "c	Cs�|jttjdd�x�tdd�D]�}x�tdd�D]u}|dkrm|jttj||�q?|j||ttj	t
|�|��f||tj||�f�q?Wq)WdS(sUtil.number.floor_divRii����i
iN(RRRt	floor_divRRR
R
Rtfloortfloat(RtaR((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyttest_floor_div�s+cCs�|jttjd�|jttjd�d}tj|�}|j|dd�|j|d|d>dkd�|j|d|>kd�d}tj||�}|jtj|d|�d�|j|dd�|j|d|d>dkd�|j|d|>kd�d
}tj||�}|jtj|dd?|�d�|j|dd�|j|d|d>dkd�|j|d|>kd�d	S(sUtil.number.getStrongPrimeiiiiiliiNiiii(RRRtgetStrongPrimetassertNotEqualR
tGCD(RtbitstxR((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyttest_getStrongPrime�s&" "$"c
Cs |jtjd�t�|jtjd�t�|jtjd�t�|jtjd�t�|jtjd�t�|jtjd�t�|jtjd$�t�|jtjd'�t�xQd)d+d,d-d.d/d0d1d2d3d4d5fD]%}|jtjt|��t�q�Wd"S(6sUtil.number.isPrimei����i����iiiili�i+ii�i=i�i�;i5wlH
l9l^l<=leEml�
�l&�l5L(l�)Sl�S�l�Z8l�5q:l?�rl}�el�B
sl=fl�^�;l�=�wNlVlV�������������������������������������������������������������������������������������lVlV�������������������������������������������������������������������������������������l�����������������������������������������������������������������������������������������iUi�i�#i�id�lu^��l�+%!alMn�z�]l�g�4�+l�I>6lS{A�KW
l�b�\\QNl�z�Ilv3l_V�B;.((R
RtisPrimetFalseR tlong(Rt	composite((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyttest_isPrime�s	cCs�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�|jtjd�d�dS(	Niii�ii@��lE�)��8^n,� ��n:�zb�|�DELU"�N79Y�� �S�h
"�*f8�<>k�tk��26"z�BT6�	�V���RNc�c�\����]�]rX"Sw~o� �8I(j�O�3��2���
ii(R
Rtsize(R((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyt	test_sizes
cCsKd}d}tjj||�}|j||j�|j||j�dS(sbTest that mpzToLongObj and longObjToMPZ (internal functions) roundtrip negative numbers correctly.l�����?<\"X�X\�	lN(Rt	_fastmatht
rsa_constructR
RR(RRRtk((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyt8test_negative_number_roundtrip_mpzToLongObj_longObjToMPZs
(t__name__t
__module__RRRRR!R&R,R1R3R7(((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyR&s		3	E						cCsddlm}|t�S(Ni����(tlist_test_cases(tCrypto.SelfTest.st_commonR:R(tconfigR:((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyt	get_testsst__main__cCstjt��S(N(tunittestt	TestSuiteR=(((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyt<lambda>$stdefaultTesttsuite(t__doc__t__revision__tsystversion_infotCrypto.Util.py21compatR?tTestCaseRR=R8RCtmain(((sF/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Util/test_number.pyt<module>s&
�	

Zerion Mini Shell 1.0