AlkantarClanX12

Your IP : 18.188.13.127


Current Path : /proc/self/root/lib/python3.6/site-packages/dns/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.6/site-packages/dns/__pycache__/entropy.cpython-36.pyc

3

�b�Wq�@s�ddlZddlZddlZddlmZmZyddlZWnek
rPddl	ZYnXGdd�de
�Ze�Zyej
�ZWnek
r�dZYnXdd�Zdd	�ZdS)
�N�)�long�binary_typec@sHeZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)�EntropyPoolNcCs�d|_d|_d|_tj�|_yddl}|j�|_d|_	Wn^t
k
r�yddl}|j�|_d|_	Wn,t
k
r�ddl
}|j�|_d|_	YnXYnXtd|j	�|_|dk	r�|jt|��d|_tj�|_nd|_d|_dS)Nr���TF)�
pool_index�digest�	next_byte�
_threadingZLock�lock�hashlibZsha1�hash�hash_len�ImportError�sha�new�md5�	bytearray�pool�stir�seeded�os�getpid�seed_pid)�self�seedrrr�r�/usr/lib/python3.6/entropy.py�__init__s0





zEntropyPool.__init__FcCsr|s|jj�zNxH|D]@}|j|jkr,d|_|d@}|j|j|N<|jd7_qWWd|sl|jj�XdS)Nr�r)r
�acquirer	rr�release)rZentropyZalready_locked�c�brrrr7s

zEntropyPool.stircCs�|js|jtj�kr�ytjd�}Wn`tk
r�y*tddd�}z|jd�}Wd|j�XWn tk
r~t	t
j
��}YnXYnXd|_tj�|_d|_t|�}|j
|d�dS)Nrz/dev/urandom�rbrT)rrrr�urandom�	Exception�open�read�close�str�timer
rr)rr�rrrr�_maybe_seedEs 
zEntropyPool._maybe_seedc
Cs�|jj�zr|j�|jdks*|j|jkr`|jjt|j	��t
|jj��|_|j|jd�d|_|j|j}|jd7_Wd|jj�X|S)NTrr)
r
r"r/r
rrr�updaterrrrr#)r�valuerrr�random_8Xs
zEntropyPool.random_8cCs|j�d|j�S)N�)r2)rrrr�	random_16gszEntropyPool.random_16cCs|j�d|j�S)Ni)r4)rrrr�	random_32jszEntropyPool.random_32cCsl||d}|td�kr td��|dkr8|j}td�}n|dkrL|j}d}n
|j}d}|||�|dS)	Nrlztoo bigil��r3i��r!)r�
ValueErrorr5r4r2)r�first�last�sizeZrand�maxrrr�random_betweenms
zEntropyPool.random_between)N)F)
�__name__�
__module__�__qualname__r rr/r2r4r5r;rrrrrs

rcCs tdk	rtjdd�Stj�SdS)Nri)�
system_random�	randrangerr4rrrrr4�sr4cCs(tdk	rtj||d�Stj||�SdS)Nr)r?r@rr;)r7r8rrr�between�srA)rZrandomr-Z_compatrrZ	threadingrrZdummy_threading�objectrrZSystemRandomr?r(r4rArrrr�<module>sb