
[Qc           @   s   d  d g Z  d d l Z d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z	 e
 d k r d GHd d l Z xR e d  D]D Z e j   \ Z Z e r Pn  e r e d d k r d e GHq q Wd GHn  d S(   t   getprimet   are_relatively_primeiNc         C   sD   x= | d k r? |  | k  r+ | |  }  } n  | |  | }  } q W|  S(   Ni    (    (   t   pt   q(    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyt   gcd   s
     c         C   s   |  d k r d Sd } x| |  d k r |  d @rg |  d | d d ?d @rS | } n  | |  |  }  } q | | d d ?d @r | } n  |  d L}  q W|  d k r d S| S(   Ni    i   i   i   (    (   t   at   bt   result(    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyt   jacobi(   s    
 


 c         C   s=   t  |  |  | } t |  | d ?|  } | | k r9 t St S(   Ni   (   R   t   powt   Falset   True(   t   xt   nt   jt   f(    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyt   jacobi_witness@   s
     c         C   sD   x= t  |  D]/ } t j j |  d  } t | |   r t Sq Wt S(   Ni   (   t   ranget   rsat   randnumt   randintR   R
   R   (   R   t   kt   _R   (    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyt   randomized_primality_testingL   s
     c         C   s   t  |  d  S(   Ni   (   R   (   t   number(    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyt   is_primed   s    	c         C   s=   x6 t  r8 t j j |   } | d O} t |  r | Sq Wd  S(   Ni   (   R   R   R   t   read_random_intR   (   t   nbitst   integer(    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyR    o   s
    	
c         C   s   t  |  |  } | d k S(   Ni   (   R   (   R   R   t   d(    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyR      s    
t   __main__s'   Running doctests 1000x or until failurei  id   i    s   %i timess   Doctests done(   t   __all__t   rsa.randnumR   R   R   R   R   R   R    R   t   __name__t   doctestR   t   countt   testmodt   failurest   tests(    (    (    s_   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/prime.pyt   <module>   s$   							