Viewing File: /usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyo

ó
Bd\Rc@sVdZddlmZdZddlZddlZddlZddlZddlZddl	Z	e	j
ddkr—e	j
ddkr—ddlTnddlTyddl
Z
Wnek
rÊdZ
nXddlZddlZd	ejfd
„ƒYZd„Zdejfd
„ƒYZid„ZedkrRd„ZejddƒndS(s0Self-test suite for generic Crypto.Random stuff iÿÿÿÿ(t
nested_scopess$Id$Niii(t*tRNGForkTestcBseZd„Zd„ZRS(cCsBtjjjƒ}|jjƒz|jjSWd|jjƒXdS(s‰
        Get `FortunaAccumulator.reseed_count`, the global count of the
        number of times that the PRNG has been reseeded.
        N(	tCryptotRandomt_UserFriendlyRNGt_get_singletont_locktacquiret_fatreseed_counttrelease(tselft
rng_singleton((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyt_get_reseed_count2s

cCsÎtjjdƒrdStjdƒ|jƒ}tjjj	ƒj
ƒtjjdƒ|jƒ}|j||ƒg}xÃt
dƒD]µ}tjƒ\}}tjƒdkrtj|ƒtj|dƒ}tjjƒtjjdƒ}|j|ƒ|jƒtjdƒntj|ƒ|jtj|dƒƒq„Wg}	i}
xD|D]<}tj|jƒƒ}|	j|ƒd|
|<|jƒqPWt|	ƒt|
jƒƒkrÊtd	tj|	ƒƒ‚ndS(
Ntwing333333Ã?ii
itwbitrbs'RNG output duplicated across fork():
%s(tsystplatformt
startswithttimetsleepRRRRRtreinittget_random_bytestassertNotEqualtrangetostpipetforktclosetfdopentatforktwritet_exittappendtbinasciithexlifytreadtlentkeystAssertionErrortpprinttpformat(Rtreseed_count_beforetreseed_count_aftertrfilestitrfdtwfdtftdatatresultstresults_dict((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pytrunTest>s>








(t__name__t
__module__RR6(((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyR0s	cCsntjjdƒ}tjdƒtjjdƒ}|jtj|ƒƒ|jtj|ƒƒ|jdƒdS(Nigš™™™™™¹?(	RRRRRtputR$tb2a_hextNone(tqtatb((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyt
_task_mainss
tRNGMultiprocessingForkTestcBseZd„ZRS(c
CsŠd}tjƒ}gt|ƒD]}|jdƒ^q}tjdƒtjjj	ƒj
ƒtjjdƒtjd|dtjj
ƒ}|jt|ƒ}gt|ƒD]}||jdƒ^qª}gt|ƒD]}||jdƒ^qÖ}tt||ƒƒ}	|jdƒ|jƒ|jƒtt|ƒƒt|ƒksgtt|	ƒƒt|	ƒkr†tdtj|	ƒfƒ‚ndS(Niig333333Ã?t	processestinitializeris'RNG output duplicated across fork():
%s(tmultiprocessingtManagerRtQueueRRRRRRRRtPoolR t	map_asyncR?tgettlisttzipRtjoinR'tsetR)R*R+(
Rtn_procstmanagerR/tqueuestpoolt
map_resulttaatbbtres((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyR6~s"(
,,


<(R7R8R6(((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyR@|scCs9g}|tƒg7}tdk	r5|tƒg7}n|S(N(RRCR;R@(tconfigttests((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyt	get_tests s
t__main__cCstjtƒƒS(N(tunittestt	TestSuiteRW(((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyt<lambda>¨stdefaultTesttsuite(t__doc__t
__future__Rt__revision__R$R*RYRRRtversion_infotCrypto.Util.py21compattCrypto.Util.py3compatRCtImportErrorR;tCrypto.Random._UserFriendlyRNGRtCrypto.Random.randomtTestCaseRR?R@RWR7R]tmain(((sR/usr/lib64/python2.7/site-packages/Crypto/SelfTest/Random/test__UserFriendlyRNG.pyt<module>s0&



C		$	
Back to Directory File Manager