B
    Â/¾OÐ
  ã               @   s2   d Z ddlmZ ddlZddlZG dd„ dƒZdS )z$Id$é    )ÚRandomPool_DeprecationWarningNc               @   sn   e Zd ZdZddd„Zdd„ Zdd	„ Zddd„Zddd„Zddd„Z	d dd„Z
d!dd„Zdd„ Zd"dd„ZdS )#Ú
RandomPoolz\Deprecated.  Use Random.new() instead.

    See http://www.pycrypto.org/randpool-broken
    é    Nc             C   s6   t  dt¡ tj ¡ | _|| _| jd | _| j| _	d S )NzqThis application uses RandomPool, which is BROKEN in older releases.  See http://www.pycrypto.org/randpool-brokené   )
ÚwarningsÚwarnr   ÚCryptoZRandomÚnewÚ_RandomPool__rngÚbytesÚbitsÚentropy)ÚselfZnumbytesZcipherÚhashÚfile© r   ú3lib/python3.7/site-packages/Crypto/Util/randpool.pyÚ__init__&   s    zRandomPool.__init__c             C   s   | j  |¡S )N)r
   Úread)r   ÚNr   r   r   Ú	get_bytes.   s    zRandomPool.get_bytesc             C   s8   |  j |7  _ | j dk r d| _ n| j | jkr4| j| _ d S )Nr   )r   r   )r   Znbitsr   r   r   Ú_updateEntropyEstimate1   s
    
z!RandomPool._updateEntropyEstimater   ú/dev/urandomc             C   s   | j  ¡  dS )zDummy _randomize() functionN)r
   Úflush)r   r   Zdevnamer   r   r   Ú
_randomize8   s    zRandomPool._randomizec             C   s   | j  ¡  dS )zDummy randomize() functionN)r
   r   )r   r   r   r   r   Ú	randomize<   s    zRandomPool.randomizeÚ c             C   s   | j  ¡  dS )zDummy stir() functionN)r
   r   )r   Úsr   r   r   Ústir@   s    zRandomPool.stiré   c             C   s   | j  ¡  dS )zDummy stir_n() functionN)r
   r   )r   r   r   r   r   Ústir_nD   s    zRandomPool.stir_nc             C   s   | j  ¡  dS )zDummy add_event() functionN)r
   r   )r   r   r   r   r   Ú	add_eventH   s    zRandomPool.add_eventc             C   s
   |   |¡S )zDummy getBytes() function)r   )r   r   r   r   r   ÚgetBytesL   s    zRandomPool.getBytesc             C   s   |   ¡ S )zDummy addEvent() function)r!   )r   Zeventr   r   r   r   ÚaddEventP   s    zRandomPool.addEvent)r   NNN)r   r   )r   )r   )r   )r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r    r!   r"   r#   r   r   r   r   r   !   s   





r   )Z__revision__ZCrypto.pct_warningsr   ZCrypto.Randomr   r   r   r   r   r   r   Ú<module>   s   