Current Path : /usr/lib/python2.7/dist-packages/Crypto/PublicKey/ |
Current File : //usr/lib/python2.7/dist-packages/Crypto/PublicKey/_DSA.pyc |
T:Nc @ s d Z d d l Td d l m Z d d l m Z m Z d d l m Z d d l Td 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__( ( ( s9 /usr/lib/python2.7/dist-packages/Crypto/PublicKey/_DSA.pyR $ s c C s/ | d } t j | j } t j t t | d j } t d } xu t d d D]d } t | | t | | A} | d k r | d B} n | d k r | d B} n | d | } qb Wx t | s | d } q Wt d d | k ot d d k n r| | f St 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 bordt isPrimet powt RuntimeError( t randfunct St hash1t hash2t qt it c( ( s9 /usr/lib/python2.7/dist-packages/Crypto/PublicKey/_DSA.pyt generateQ' s % . c C s | d k r t d n t } | r7 | d n xt | \ } | _ t | d d d } d d i } } } | j d ?d @} t t d | } t t d | d } x | d k rxN t d | d D]9 } t t j | t | t | j | | <q W| | | } x0 t | d d d D] } | d >| | } q>W| | } | | d | j d } | | k rt | rPn | d | | d } } q W| d k rPn | r: | d q: q: | | _ t | d | j d } | r| d n x_ t | | | d } t | | | } d | k o\| d k n r| d k rPqq| | _ | r| d n x8 t | d } d | k o| j k n rPqq| 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 il s 4096 multiples failed s h,g s x,y i ( t ValueErrort DSAobjR R t divmodR R R R R R t bstrR 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 ( ( s9 /usr/lib/python2.7/dist-packages/Crypto/PublicKey/_DSA.pyt generate_py9 sZ 7 , R c B s e Z RS( ( R R ( ( ( s9 /usr/lib/python2.7/dist-packages/Crypto/PublicKey/_DSA.pyR q s N( ( t __revision__t Crypto.PublicKey.pubkeyt Crypto.UtilR t Crypto.Util.numberR R t Crypto.HashR t Crypto.Util.py3compatt ExceptionR R t NoneR/ R ( ( ( s9 /usr/lib/python2.7/dist-packages/Crypto/PublicKey/_DSA.pyt <module> s 8