Ñò
ðgcJc           @   sé   d  d k  Z  d  d k Z d  d k l Z y d  d k Z Wn e j
 o d Z n Xd „  Z e d j	 o e i	 ƒ  i
 ƒ  d j p e  i d j o  d  d k l Z e i ƒ  Z n d  d k l Z e i ƒ  Z d e f d	 „  ƒ  YZ d S(
   iÿÿÿÿN(   t
   RandomPoolc         C   s<   t  |  ƒ t  | ƒ j p t ‚ d i t d „  |  | ƒ ƒ S(   Nt    c         S   s   t  t |  ƒ t | ƒ Aƒ S(    (   t   chrt   ord(   t   xt   y(    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyt   <lambda>    s    (   t   lent   AssertionErrort   joint   map(   t   at   b(    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyt   _strxor   s     t   windowst   win32(   t	   rng_win32(   t	   rng_posixt   StrongLockingRandomPoolc           B   sG   e  Z d  Z d d „ Z d d „ Z d d „ Z d d „ Z d „  Z RS(	   s÷  Wrapper around RandomPool guaranteeing strong random numbers.
    
    Crypto.Util.randpool.RandomPool will silently operate even if it is seeded
    with little or no entropy, and it provides no prediction resistance if its
    state is ever compromised throughout its runtime.  It is also not thread-safe.

    This wrapper augments RandomPool by XORing its output with random bits from
    the operating system, and by controlling access to the underlying
    RandomPool using an exclusive lock.
    c         C   sh   | d  j o t ƒ  } n | |  _ t i ƒ  |  _ t |  _ |  i i |  i i	 d ƒ ƒ |  i i
 ƒ  d  S(   Ni    (   t   Nonet   _RandomPoolt   randpoolt	   threadingt   Lockt   randpool_lockt
   rng_devicet   entropyt   stirt   readt	   randomize(   t   selft   instance(    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyt   __init__C   s    		R   c         C   sC   |  i  i ƒ  z |  i i | ƒ Wd  |  i  i ƒ  X|  i i ƒ  d  S(   N(   R   t   acquireR   R   t   releaseR   R   (   R   t   s(    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyR   N   s
    i    c         C   sC   |  i  i ƒ  z |  i i | ƒ Wd  |  i  i ƒ  X|  i i ƒ  d  S(   N(   R   R!   R   R   R"   R   (   R   t   N(    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyR   V   s
    c         C   s6   |  i  i ƒ  z |  i i | ƒ Wd  |  i  i ƒ  Xd  S(   N(   R   R!   R   t	   add_eventR"   (   R   R#   (    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyR%   ^   s    c         C   s™   |  i  i ƒ  z |  i i | ƒ } Wd  |  i  i ƒ  X|  i i | ƒ } t | | ƒ } t | ƒ | j o& t | ƒ | j o t | ƒ | j p t	 ‚ | S(   N(
   R   R!   R   t	   get_bytesR"   R   R   R   R   R   (   R   R$   t   randpool_datat   entropy_datat   result(    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyR&   e   s    @N(	   t   __name__t
   __module__t   __doc__R   R    R   R   R%   R&   (    (    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyR   7   s   
(   t   sysR   t   Crypto.Util.randpoolR    R   t   platformt   ImportErrorR   R   t   systemt   lowert   paramikoR   t   open_rng_deviceR   R   t   objectR   (    (    (    sK   C:\Documents and Settings\red08xgu\Desktop\python_webupdate\paramiko\rng.pyt   <module>   s   	&