U q`@sPdZddlZddlmZddlmZmZddlmZddZ Gdd d e Z dS) z, Utility functions for dealing with primes. N)util) byte_masklong) SSHExceptioncCstt|d}|dd}td|dd}t|}|dkrXt|d||dd}t|d}||kr,qpq,|S)z returns a random # from 0 to N-1rN)r bit_lengthpowosurandomrZ inflate_long)nbitsZ byte_countZ hbyte_maskxnumr6/tmp/pip-target-nv4zd3e_/lib/python/paramiko/primes.py _roll_randoms   rc@s0eZdZdZddZddZddZdd Zd S) ModulusPackzx convenience object for holding the contents of the /etc/ssh/moduli file, on systems that have such a file. cCsi|_g|_dS)N)pack discarded)selfrrr__init__:szModulusPack.__init__c Cs|\}}}}}}}t|}t|}t|}t|}t|}t|d}|dksp|dksp|d@r|dkr|dkr|j|dfdS|dkrd}t|} | |kr| |dkr|j|d |fdS| |jkrg|j| <|j| ||fdS) Nr rdz does not meet basic requirementsrrz"incorrectly reported bit length {}) splitintrrappendrr formatr) rline timestampmod_typeteststriessize generatormodulusblrrr_parse_modulus?sP      zModulusPack._parse_modulusc Csli|_t|dR}|D]F}|}t|dks|ddkrs