403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/Crypto/Util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyc
Ñò
6š@c@sZdZddkZddkZddkZddkZddkZddklZyddk	i
iZWn
eZnXdZ
dfd„ƒYZdefd„ƒYZd	Zeo7y)ddkZd
fd„ƒYZdZWnnXneo7y)ddkZd
fd
„ƒYZdZWnnXndefd„ƒYZedjoeƒZdGeiGdGHeidƒeidƒ
GHddkZddkZeiƒZedeƒZdGeiGdGHeiƒdGeiGdGHeidƒeiƒeedƒi ƒZ!dGe!
GHdGei"i#ƒ
GHeeƒZ$dGeiGdGHei%eƒndS(s;$Id: randpool.py,v 1.14 2004/05/06 12:56:54 akuchling Exp $iÿÿÿÿN(t
long_to_bytesit
RandomPoolcBs¡eZdZdddd„Zd„Zddd„Zdd„Zed„Z	d	d
„Z
d„Zd	d„Zd
„Z
d„Zd„Zd„Zd	d„ZRS(s1randpool.py : Cryptographically strong random number generation.

    The implementation here is similar to the one in PGP.  To be
    cryptographically strong, it must be difficult to determine the RNG's
    output, whether in the future or the past.  This is done by using
    a cryptographic hash function to "stir" the random data.

    Entropy is gathered in the same fashion as PGP; the highest-resolution
    clock around is read and the data is added to the random number pool.
    A conservative estimate of the entropy is then kept.

    If a cryptographically secure random source is available (/dev/urandom
    on many Unixes, Windows CryptGenRandom on most Windows), then use
    it.

    Instance Attributes:
    bits : int
      Maximum size of pool in bits
    bytes : int
      Maximum size of pool in bytes
    entropy : int
      Number of bits of entropy in this pool.

    Methods:
    add_event([s]) : add some entropy to the pool
    get_bytes(int) : get N bytes of random data
    randomize([N]) : get N bytes of randomness from external source
    i cCs|djoddkl}n|dj	otidƒnt|tiƒo-td|dddgƒ}tidƒn||_	|i	d|_
d|_||_t
i
d	dg|i	ƒ|_d|_|_d|_|i|_tiƒ|_d|_|iƒ|iƒdS(
Niÿÿÿÿ(tSHAs$'cipher' parameter is no longer usedsCrypto.Hash.tnews/'hash' parameter should now be a hashing moduleiitB(tNonetCrypto.HashRtwarningstwarnt
isinstancettypest
StringTypet
__import__tbytestbitstentropyt_hashtarrayt	_randpoolt_event1t_event2t_addPostdigest_sizet_getPosttimet_lastcountert_RandomPool__countert_measureTickSizet
_randomize(tselftnumbytestcipherthash((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyt__init__7s(


					
cCsS|i|7_|idjo
d|_n$|i|ijo|i|_ndS(Ni(RR(Rtnbits((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyt_updateEntropyEstimateYs

is/dev/urandomcCs$d}|djo"t|i|iddƒ}nt|ddƒ}totiƒi|ƒ}ntii|ƒoky)t	|ƒ}|i
|ƒ}|iƒWqçtj
o/\}}|djot||f‚qãqçXn|o(|i
|ƒ|idt|ƒƒn|iƒdS(sl_randomize(N, DEVNAME:device-filepath)
        collects N bits of randomness from some entropy source (e.g.,
        /dev/urandom on Unixes that have it, Windows CryptoAPI
        CryptGenRandom, etc)
        DEVNAME is optional, defaults to /dev/urandom.  You can change it
        to /dev/random if you want to block till you get enough
        entropy.
        tiigà?iN(tintRRt	winrandomRt	get_bytestostpathtexiststopentreadtclosetIOErrort	_addBytesR#tlentstir_n(RtNtdevnametdatatnbytestftnumtmsg((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR`s$	
"

cCs
|i|ƒS(s‹randomize(N:int)
        use the class entropy source to get some entropy data.
        This is overridden by KeyboardRandomize().
        (R(RR2((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyt	randomizescCs%xt|ƒD]}|iƒq
WdS(s8stir_n(N)
        stirs the random pool N times
        N(txrangetstir(RR2ti((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR1ˆs
R$cCsÔ|i}|iƒxŽt|i|iiƒD]s}|ii|iƒ}|it	|i
ƒt	|ƒt	|iƒ|ƒ|i|i
ƒƒ|i
dd@|_
q-Wd|ii|_|_|iƒ||_dS(s
stir(s:string)
        Mix up the randomness pool.  This will call add_event() twice,
        but out of paranoia the entropy attribute will not be
        increased.  The optional 's' parameter is a string that will
        be hashed with the randomness pool.
        ilÿÿiN(Rt	add_eventtrangeR
RRRRtupdatetstrRRR/tdigestR(RtsRR<th((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR;s	
1
cCsÛd}|i|i}}|iiƒ}|ii}|}x||djon|i|i|||!ƒ||iƒ}||}|||i}||jo|iƒ|i}q=q=W||_|i	d|ƒ|| S(sIget_bytes(N:int) : string
        Return N bytes of random data.
        R$iiøÿÿÿ(
RRRRRR?RAR
R;R#(RR2RBR<tpoolRCtdsizeR7((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR'ªs"



	cCsãtiƒd}|iƒ}|t|ƒdtdƒt|ƒ}|i|ƒ||ijo||ijo
d}nBd}x!|o|d?|d}}q„W|djo
d}n||i|_|_|i|ƒ|S(s9add_event(s:string)
        Add an event to the random pool.  The current time is stored
        between calls and used to estimate the entropy.  The optional
        's' parameter is a string that will also be XORed into the pool.
        Returns the estimated number of additional bits of entropy gain.
        ièiiªiii(Rt_noiseRtchrR/RRR#(RRBteventtdeltaR((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR=Âs(
 



cCsÃtiƒ}||i|id}||_|ittdtiƒƒƒƒ|ittdtiƒƒƒƒ|ittdtiƒƒƒƒ|itt|ƒƒƒ|d}t|ƒS(Ng€„.Aièiÿ(RRt	_ticksizeR/RtlongtclockR%(RttRI((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRFßs	###
cCs"dgd}|iit|ƒt|ƒf
ƒ}tiƒ}|i|
ƒd}d}xx|djojtiƒ}|i|||f
ƒ|d7}t||dƒ}|o|||<|d7}|}q[q[W|iƒ|t|ƒd|_	|i||i	f
ƒ|i
|iƒƒdS(Nidiig€„.Ai(RRRtidRR?R%tsortR0RJR;RA(RtintervalRCRMR<tjtt2RI((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRòs(
%




cCsm|i|i}}xJtdt|ƒƒD]3}||t||ƒA||<|d|i}q)W||_dS(s5XOR the contents of the string S into the random pooliiN(RRR>R0tordR
(RRBR<RDRQ((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR/scCstidtƒ|i|ƒS(Ns)getBytes() method replaced by get_bytes()(RRtDeprecationWarningR'(RR2((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pytgetBytess	cCs'tidtƒ|i|t|ƒƒS(Ns)addEvent() method replaced by add_event()(RRRTR=R@(RRHRB((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pytaddEvents	N(t__name__t
__module__t__doc__RR!R#RR9tSTIRNUMR1R;R'R=RFRR/RURV(((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRs"	!						tPersistentRandomPoolcBseZdd„Zd„ZRS(cOs‹ti|||Ž||_|odyJt|dƒ}|iƒ|iƒ}|iƒ|i|ƒ|iƒWq‡tj
oq‡XndS(Ntrb(	RR!tfilenameR+R=R,R;R-R.(RR]targstkwargsR6R4((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR!%s	


cCs{|idjo
td‚n|iƒt|idƒ}|iƒ|i|iiƒƒ|iƒ|iƒ|i	ƒdS(NR$sNo filename set for this objecttwb(
R]t
ValueErrorR1R+R=twriteRttostringR-R;(RR6((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pytsave8s




N(RWRXRR!Rd(((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR[$sit
KeyboardEntrycBseZd„Zdd„ZRS(cCs1tiƒ}|djo|tiƒ7}n|S(Ntsà(ssà(tmsvcrttgetch(Rtc((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRhLs
icCs;|o0ti|ƒx tiƒotiƒqWndS(N(RtsleepRgtkbhitRh(Rtdelay((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR-Rs


(RWRXRhR-(((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyReKs	icBs)eZdd„Zd„Zdd„ZRS(icCsb||_ti|ƒ|_ti|ƒ}|dti@ti@|d<ti|ti|ƒdS(Ni(t_fdttermiost	tcgetattrt_oldtICANONtECHOt	tcsetattrtTCSANOW(RtfdR((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR!`s
	cCs&tidtiƒti|idƒS(Nii(RnttcflushtTCIFLUSHR(R,Rm(R((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRhfscCsN|o'ti|ƒti|itiƒnti|iti|iƒdS(N(	RRjRnRvRmRwRst	TCSAFLUSHRp(RRl((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR-is
(RWRXR!RhR-(((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRe_s	tKeyboardRandomPoolcBseZd„Zdd„ZRS(cOsti|||ŽdS(N(R[R!(RR^R_((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR!ssicCsZddk}ddk}ddk}|djo|i|i}n|d}|djodS|GdGHdGHtƒ}d}|i}d}	zŸxx|	|jojt||	ƒidƒ}
|i	d	|
ƒ||i
ƒ}|	|i|ƒ7}	|i	d	dtdƒƒq“W|i||i
|ƒiƒƒWd|iƒXd
GH|iƒ|idƒdS(s@Adds N bits of entropy to random pool.  If N is 0, fill up pool.iÿÿÿÿNiis>bits of entropy are now required.  Please type on the keyboards-until enough randomness has been accumulated.R$iis"
 Enough.  Please wait a moment.
i(R(tstringRRRReRR@trjustRbRhR=RGRRAR-R1(RR2R(RzRRtkbRBR tettemp((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyR9vs2$


			
$
(RWRXR!R9(((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyRyrs	t__main__srandom pool entropyRt	somethingidR]skeyboard random pool entropyi€R\tsavedspool spersistent random pool entropy(&t__revision__RRR
Rtos.pathR(tCrypto.Util.numberRtCrypto.Util.winrandomtUtilR&RRZRR[t_kbRgReRnRyRWRDRR=R'ttempfiletmktemptfnameR9RdR+R,RRRctnewpooltremove(((s8/usr/lib/python2.6/site-packages/Crypto/Util/randpool.pyt<module>
sZ<
ÿ
#

!
	






Youez - 2016 - github.com/yon3zu
LinuXploit