| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/ |
Upload File : |
ó T:´Nc @ s¨ d Z d Z d d l Z e j d d k rK e j d d k rK d d l Tn d d l Z d e j f d YZ i d Z e d k r¤ d Z e j d d n d S( s+ Self-tests for (some of) Crypto.Util.numbers $Id$i˙˙˙˙Ni i i ( t *t MiscTestsc B sP e Z d Z d Z d Z d Z d Z d Z d Z d Z RS( c C s d d l m a d d l a d S( Ni˙˙˙˙( t number( t Crypto.UtilR t math( t self( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt setUp' s c C s˝ | j t t j d d | j t t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d xt d d d D]x} | j d t j d | d } xM| d | d k r´t | d d | \ } } | t | } | j | d | | f | d | t j | d | f t | d | \ } } | t | } | j | | | f | | t j | | f t | d d | \ } } | t | } | j | d | | f | d | t j | d | f | d 9} qhWq=Wd S( s Util.number.ceil_shifti˙˙˙˙i i i i i i i i i i i l l Ni ( t assertRaisest AssertionErrorR t ceil_shiftt assertEqualt ranget divmodt int( R t bt nt qt rt expected( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt test_ceil_shift, sJ $$c C să | j t t j d d | j t t j d d | j t t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d d S( s Util.number.ceil_divt 1i i i˙˙˙˙iţ˙˙˙i iý˙˙˙i i i i i i i i÷˙˙˙iü˙˙˙iř˙˙˙iů˙˙˙iú˙˙˙iű˙˙˙N( R t TypeErrorR t ceil_divt ZeroDivisionErrorR ( R ( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt test_ceil_div_ sl c C sá | j t t j d | j t t j d | j t t j d | j d t j d | j d t j d | j t t j d | j d t j d | j t t j d | j t t j d | j t t j d d } d } xs | d k rf| d | k rC| j | t j | d | | f | d 7} n | j t t j | | d 7} qô Wxs t d d d D]_ } | j t t j d | d | j | t j d | | j t t j d | d qzWd S( s Util.number.exact_log2t 0i˙˙˙˙i i i i i i i i i i s expected=2**%d, n=%di@ l NiA ( R R R t exact_log2t ValueErrorR R ( R t eR ( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt test_exact_log2¤ s, & c C sž | j d t j d d | j t t j d d | j d t j d d | j t t j d d | j d t j d d | j d t j d d | j d t j d d | j t t j d d | j d t j d d | j d t j d d | j d t j d d | j d t j d d | j t t j d d | j t t j d d | j d t j d d d t | j t t j d d d t d S( s Util.number.exact_divi i i i i˙˙˙˙iţ˙˙˙iü˙˙˙i t allow_divzeroN( R R t exact_divR R R t True( R ( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt test_exact_divż s "c C sŔ | j t t j d d x t d d D] } x t d d D]u } | d k rm | j t t j | | q? | j | | t t j t | | f | | t j | | f q? Wq) Wd S( s Util.number.floor_divR i iö˙˙˙i i N( R R R t floor_divR R R R R t floort float( R t aR ( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt test_floor_divÜ s +c C sŠ | j t t j d | j t t j d d } t j | } | j | d d | j | d | d >d k d | j | d | >k d d } t j | | } | j t j | d | d | j | d d | j | d | d >d k d | j | d | >k d d } t j | | } | j t j | d d ?| d | j | d d | j | d | d >d k d | j | d | >k d d S( s Util.number.getStrongPrimei i i i i l i i Ni i i i ( R R R t getStrongPrimet assertNotEqualR t GCD( R t bitst xR ( ( sD /usr/lib/python2.7/dist-packages/Crypto/SelfTest/Util/test_number.pyt test_getStrongPrimeç s&