Current File : //usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyc
�
Bd\Rc@sMdZddlZejddkrEejddkrEddlTnddlZddlZddlZddlZddlm	Z	ddl
mZdd	lm
Z
d
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZej�Zdad�Zd�Zd�Zd�ZdS(s$Id$i����Niii(t*(tfloor(tOSRNG(tFortunaAccumulatort_EntropySourcecBseZd�Zd�ZRS(cCs||_||_d|_dS(Ni(t_fortunat_src_numt	_pool_num(tselftaccumulatortsrc_num((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyt__init__)s		cCs4|jj|j|j|�|jdd@|_dS(Nii(Rtadd_random_eventRR(Rtdata((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pytfeed.s(t__name__t
__module__RR(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR(s	t_EntropyCollectorcBs#eZd�Zd�Zd�ZRS(cCsItj�|_t|d�|_t|d�|_t|d�|_dS(Ni�i�i�(Rtnewt_osrngRt	_osrng_est_time_est	_clock_es(RR	((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR4scCszxftd�D]X}|jjd�}x7td�D])}|jj||d|dd!�q2Wd}q
W|jj�dS(Nii ii(trangeRtreadRRtNonetflush(Rtitblocktp((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pytreinit:s'
cCs�|jj|jjd��tj�}|jjtjdtd|t	|����tj
�}|jjtjdtd|t	|����dS(Nis@Iiii@i@(RRRRttimeRtstructtpacktintRtclockR(Rtt((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pytcollectDs
0(RRRRR%(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR2s		
t_UserFriendlyRNGcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs8t|_tj�|_t|j�|_|j�dS(N(tFalsetclosedRt_faRt_ecR(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyRSs	cCs-tj�|_|jj�|jj�dS(skInitialize the random number generator and seed it with entropy from
        the operating system.
        N(tostgetpidt_pidR*RR)t_forget_last_reseed(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyRYs
cCst|_d|_d|_dS(N(tTrueR(RRR)(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pytcloseos		cCsdS(N((R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyRtscCs�|jrtd��nt|ttf�s<td��n|dkrWtd��n|jj�|jj	|�}|j
�|S(sReturn N bytes from the RNG.sI/O operation on closed filesan integer is requiredis%cannot read to end of infinite stream(R(t
ValueErrort
isinstancetlongR"t	TypeErrorR*R%R)trandom_datat
_check_pid(RtNtretval((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyRws	

cCs(tj�|jkr$td��ndS(NsTPID check failed. RNG must be re-initialized after fork(). Hint: Try Random.atfork()(R+R,R-tAssertionError(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR6�s
(RRRRR0RRR6(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR&Qs					t_LockingUserFriendlyRNGcBs,eZd�Zd�Zd�Zd�ZRS(cCs tj�|_tj|�dS(N(t	threadingtLockt_lockR&R(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�scCs3|jj�ztj|�SWd|jj�XdS(N(R=tacquireR&R0trelease(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR0�s
cCs3|jj�ztj|�SWd|jj�XdS(N(R=R>R&RR?(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�s
cCs6|jj�ztj||�SWd|jj�XdS(N(R=R>R&RR?(Rtbytes((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�s
(RRRR0RR(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR:�s			tRNGFilecBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCst|_||_dS(N(R'R(t
_singleton(Rt	singleton((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�s	cCsdS(sPEP 343 supportN((R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyt	__enter__�scCs|j�dS(sPEP 343 supportN(R0(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyt__exit__�scCst|_d|_dS(N(R/R(RRB(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR0�s	cCs(|jrtd��n|jj|�S(NsI/O operation on closed file(R(R1RBR(RR@((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�s	cCs|jrtd��ndS(NsI/O operation on closed file(R(R1(R((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�s	(RRRRDRER0RR(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyRA�s					cCs<tj�z tdkr%t�antSWdtj�XdS(N(t_singleton_lockR>RBRR:R?(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyt_get_singleton�s
cCs
tt��S(N(RARG(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�scCst�j�dS(N(RGR(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyR�scCst�j|�S(sEReturn the specified number of cryptographically-strong random bytes.(RGR(tn((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pytget_random_bytes�s(t__revision__tsystversion_infotCrypto.Util.py21compatR+R;R RtmathRt
Crypto.RandomRtCrypto.Random.FortunaRtobjectRRR&R:RAR<RFRRBRGRRRI(((sD/usr/lib64/python2.7/site-packages/Crypto/Random/_UserFriendlyRNG.pyt<module>s*&

K