<s> __revision__ = "<STR_LIT>" <EOL> from Crypto . PublicKey import pubkey <EOL> from Crypto . Util import number <EOL> def generate_py ( bits , randfunc , progress_func = None , e = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> obj = RSAobj ( ) <EOL> obj . e = long ( e ) <EOL> if progress_func : <EOL> progress_func ( '<STR_LIT>' ) <EOL> p = q = <NUM_LIT:1> L <EOL> while number . size ( p * q ) < bits : <EOL> p = pubkey . getStrongPrime ( bits >> <NUM_LIT:1> , obj . e , <NUM_LIT> , randfunc ) <EOL> q = pubkey . getStrongPrime ( bits - ( bits >> <NUM_LIT:1> ) , obj . e , <NUM_LIT> , randfunc ) <EOL> if p > q : <EOL> ( p , q ) = ( q , p ) <EOL> obj . p = p <EOL> obj . q = q <EOL> if progress_func : <EOL> progress_func ( '<STR_LIT>' ) <EOL> obj . u = pubkey . inverse ( obj . p , obj . q ) <EOL> obj . n = obj . p * obj . q <EOL> if progress_func : <EOL> progress_func ( '<STR_LIT>' ) <EOL> obj . d = pubkey . inverse ( obj . e , ( obj . p - <NUM_LIT:1> ) * ( obj . q - <NUM_LIT:1> ) ) <EOL> assert bits <= <NUM_LIT:1> + obj . size ( ) , "<STR_LIT>" <EOL> return obj <EOL> class RSAobj ( pubkey . pubkey ) : <EOL> def size ( self ) : <EOL> """<STR_LIT>""" <EOL> return number . size ( self . n ) - <NUM_LIT:1> </s>
