ó
æ¨[Qc           @   s_   d  „  Z  d „  Z d „  Z d „  Z d „  Z d „  Z e d k r[ d d l Z e j ƒ  n  d S(	   c         C   sÆ   |  d k r d S|  d k  r& |  }  n  |  d @d |  } t  | ƒ d d i d d 6d d 6d d 6d d	 6d
 d 6d
 d 6d
 d 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6| d S(   Ni    i   s   %xi   t   0t   1i   t   2t   3i   t   4t   5t   6t   7t   8t   9t   at   bt   ct   dt   et   f(   t   len(   t   numt   hex_num(    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt   bit_size   s    

c         C   sZ   |  d k  r t  d |  ƒ ‚ n  |  d k r/ d Sd } x |  rU | d 7} |  d L}  q8 W| S(   Ni    s%   Only nonnegative numbers possible: %si   (   t
   ValueError(   t   numbert   bits(    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt	   _bit_size=   s    	
c         C   s>   t  t |  ƒ d ƒ \ } } | s- |  d k r: | d 7} n  | S(   Ni   i    i   (   t   divmodR   (   R   t   quantat   mod(    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt	   byte_sizeQ   s    c   	      C   s»   d } d } d } d } |  } | } xU | d k r{ |  | } | |  | }  } | | | | } } | | | | } } q' W| d k  r• | | 7} n  | d k  r® | | 7} n  |  | | f S(   Ni    i   (    (	   R
   R   t   xt   yt   lxt   lyt   oat   obt   q(    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt   extended_gcdl   s     
  c         C   sA   t  |  | ƒ \ } } } | d k r= t d |  | f ƒ ‚ n  | S(   Ni   s*   x (%d) and n (%d) are not relatively prime(   R#   R   (   R   t   nt   dividert   invt   _(    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt   inverseƒ   s    	c   	      C   sz   d } d } x | D] } | | 9} q WxL t  | |  ƒ D]; \ } } | | } t | | ƒ } | | | | | } q7 W| S(   Ni   i    (   t   zipR(   (	   t   a_valuest   modulo_valuest   mR   t   modulot   m_it   a_it   M_iR&   (    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt   crt”   s    
t   __main__iÿÿÿÿN(	   R   R   R   R#   R(   R1   t   __name__t   doctestt   testmod(    (    (    s`   /home/tom/ab/x64lucid-deps/install/lib/python2.7/site-packages/rsa-3.1.1-py2.7.egg/rsa/common.pyt   <module>   s   	)					"