Ñò
BwLc           @   sˆ   d  Z  d d k Td d k l Z d d k l Z l Z d d k l Z d e	 f d „  ƒ  YZ
 d „  Z d d	 „ Z d
 d d „  ƒ  YZ d S(   s   $Id$iÿÿÿÿ(   t   *(   t   number(   t   bytes_to_longt   long_to_bytes(   t   SHAt   errorc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sT   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\_DSA.pyR   #   s   c         C   s8  |  d ƒ } t  i | ƒ i ƒ  } t  i t t | ƒ d ƒ ƒ i ƒ  } t d ƒ } xy t d d ƒ D]h } t | | ƒ t | | ƒ A} | d j o | d B} n | d j o | d B} n | d | } qb Wx t | ƒ p | d } qÑ Wt	 d d ƒ | j  o t	 d d	 ƒ j  n o | | f St
 d
 ƒ ‚ d  S(   Ni   i   i    i€   i   i   i   l   Ÿ l     s   Bad q value generated(   R   t   newt   digestR   R   t   bignumt   ranget   ordt   isPrimet   powt   RuntimeError(   t   randfunct   St   hash1t   hash2t   qt   it   c(    (    sT   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\_DSA.pyt	   generateQ&   s$    %  0c         C   s  |  d j  o t  d ƒ ‚ n t ƒ  } | o | d ƒ n x«t | ƒ \ } | _ t |  d d ƒ d } d d h  } } } | i d ?d @}	 t t d ƒ |	 ƒ }
 t t d ƒ |  d ƒ } xÿ | d	 j  oñ xN t d | d ƒ D]9 } t t	 i
 | t | ƒ t | ƒ ƒ i ƒ  ƒ | | <qá W| | |
 } x0 t | d d
 d
 ƒ D] } | d >| | } qCW| | } | | d | i d } | | j o t | ƒ o Pn | d | | d } } qÀ W| d	 j  o Pn | o | d ƒ q> q> | | _ t | d | i ƒ d } | o | d ƒ n xc t | |  ƒ ƒ | d } t | | | ƒ } d | j  o | d j  n o | d j o Pq$q$| | _ | o | d ƒ n x; t | d ƒ ƒ } d | j  o | i j  n o Pq¨q¨| t | | | ƒ | _ | _ | S(   sè   generate(bits:int, randfunc:callable, progress_func:callable)

    Generate a DSA key of length 'bits', using 'randfunc' to get
    random data and 'progress_func', if present, to display
    the progress of the key generation.
    i    s   Key length < 160 bitss   p,q
i   i    i   i   i   i   iÿÿÿÿl     s   4096 multiples failed
s   h,g
s   x,y
i   (   t
   ValueErrort   DSAobjR   R   t   divmodR   R
   R   R   R   R   t   strR	   R   t   pt   gt   xt   y(   t   bitsR   t   progress_funct   objR   t   nt   Ct   Nt   Vt   bt   powbt   powL1t   kt   Wt   XR   t   powert   hR   R   (    (    sT   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\_DSA.pyt   generate_py8   s`    	  7 
	/	!R   c           B   s   e  Z RS(    (   R   R   (    (    (    sT   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\_DSA.pyR   p   s   N(    (   t   __revision__t   Crypto.PublicKey.pubkeyt   Crypto.UtilR   t   Crypto.Util.numberR   R   t   Crypto.HashR   t	   ExceptionR   R   t   NoneR/   R   (    (    (    sT   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\Crypto\PublicKey\_DSA.pyt   <module>   s   
	8