/usr/lib/python2.6/site-packages/rsa
NameSizeModeActions
asn1.py17810644editdlrm
asn1.pyc16530644editdlrm
asn1.pyo16530644editdlrm
bigfile.py51850644editdlrm
bigfile.pyc47860644editdlrm
bigfile.pyo47860644editdlrm
cli.py121850644editdlrm
cli.pyc133190644editdlrm
cli.pyo133190644editdlrm
common.py46400644editdlrm
common.pyc42350644editdlrm
common.pyo42350644editdlrm
core.py16560644editdlrm
core.pyc14850644editdlrm
core.pyo14850644editdlrm
key.py228670644editdlrm
key.pyc239860644editdlrm
key.pyo239860644editdlrm
parallel.py22990644editdlrm
parallel.pyc20980644editdlrm
parallel.pyo20980644editdlrm
pem.py35370644editdlrm
pem.pyc28430644editdlrm
pem.pyo28430644editdlrm
pkcs1.py122300644editdlrm
pkcs1.pyc111730644editdlrm
pkcs1.pyo111260644editdlrm
prime.py45600644editdlrm
prime.pyc36640644editdlrm
prime.pyo36180644editdlrm
randnum.py26430644editdlrm
randnum.pyc20740644editdlrm
randnum.pyo20740644editdlrm
transform.py68920644editdlrm
transform.pyc58560644editdlrm
transform.pyo58560644editdlrm
util.py30590644editdlrm
util.pyc25200644editdlrm
util.pyo24490644editdlrm
varblock.py54060644editdlrm
varblock.pyc48560644editdlrm
varblock.pyo48560644editdlrm
_compat.py38900644editdlrm
_compat.pyc36550644editdlrm
_compat.pyo36550644editdlrm
_version133.py117640644editdlrm
_version133.pyc136390644editdlrm
_version133.pyo136390644editdlrm
_version200.py151230644editdlrm
_version200.pyc152640644editdlrm
_version200.pyo152640644editdlrm
__init__.py14760644editdlrm
__init__.pyc11120644editdlrm
__init__.pyo11120644editdlrm
Edit: /usr/lib/python2.6/site-packages/rsa/_version133.pyc (13639B)
Ñò |~úVc@sHdZdZdZdZyddkZWnej oddkZnXddklZlZddk Z ddk Z ddk Z ddk Z ddk Z ddkZddkZddklZddkZeideƒeid eƒd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#d„Z$d„Z%d„Z&d„Z'd„Z(d„Z)d„Z*d„Z+d „Z,d!„Z-d"„Z.d#„Z/d$„Z0d%„Z1d&„Z2d'„Z3d(„Z4ed)joddk5Z5e5i6ƒnd*d+d,d-d.gZ7dS(/s_Deprecated version of the RSA module .. deprecated:: 2.0 This submodule is deprecated and will be completely removed as of version 4.0. Module for calculating large primes, and RSA encryption, decryption, signing and verification. Includes generating public and private keys. WARNING: this code implements the mathematics of RSA. It is not suitable for real-world secure cryptography purposes. It has not been reviewed by a security expert. It does not include padding of data. There are many ways in which the output of this module, when used without any modification, can be sucessfully attacked. s.Sybren Stuvel, Marloes de Boer and Ivo Tamboers 2010-02-05s1.3.3iÿÿÿÿN(tdumpstloads(tbytes@Insecure version of the RSA module is imported as %s, be carefulsNThis submodule is deprecated and will be completely removed as of version 4.0.cCsD||jot||ƒS|djo|St|t||ƒƒS(sNReturns the greatest common divisor of p and q >>> gcd(42, 6) 6 i(tgcdtabs(tptq((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyR?s   cCs‘t|ƒtijpt|ƒtijptdƒ‚nd}xH|D]@}|d9}t|ƒtijot|ƒ}n||7}qIW|S(s7Converts a list of bytes or a string to an integer s You must pass a string or a listii(ttypettypestListTypet StringTypet TypeErrortord(tbytestintegerR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt bytes2intJs, cCst|ƒtijpt|ƒtijptdƒ‚nd}x6|djo(dt|d@ƒ|f}|d:}qEW|S(s+Converts a number to a string of bytes sYou must pass a long or an inttis%s%siÿi(RRtLongTypetIntTypeR R(tnumbertstring((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt int2bytesZs, cCsu||}g}x-|djo|i|d@ƒ|d?}qWx.|o&|iƒ}|||d|}qCW|S(sCalculates r = a^p mod n ii(tappendtpop(taRtntresultt remainderstrem((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytfast_exponentiationis   cCs)t|dƒ}ti|ƒ}t|ƒS(sPReads a random integer of approximately nbits bits rounded up to whole bytesg @(tceiltosturandomR(tnbitstnbytest randomdata((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytread_random_intvscCstti|ƒƒS(sceil(x) -> int(math.ceil(x))(tinttmathR(tx((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyR~scCsgd}||}tti|dƒdƒ}t|d|dƒ}ti||ƒ}t|ƒ||S(s9Returns a random integer x with minvalue <= x <= maxvaluei ig @i(RR&tlogtmaxtrandomtrandintR$(tminvaluetmaxvaluet min_nbitstranget rangebytest rangebitsR!((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyR+ƒs  cCs'td|dƒ}t||d|ƒS(sPReturns 1 if p may be prime, and something else if p definitely is not primei(R+R(RR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytfermat_little_theorem˜scCs§||djodSd}x„|djov|d@o;|d|dd?d@o | }n|||}}q|ddd?d@o | }n|d?}qW|S(s4Calculates the value of the Jacobi symbol (a/b) iiii((RtbR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytjacobiŸs    cCsCt||ƒ|}t||dd|ƒ}||jotStS(sUReturns False if n is an Euler pseudo-prime with base x, and True otherwise. ii(R4RtFalsetTrue(R'Rtjtf((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytjacobi_witness±s  cCsmd}t|tid|dƒƒ}x@t|dƒD].}td|dƒ}t||ƒotSq7WtS(sÓCalculates whether n is composite (which is always correct) or prime (which is incorrect with error probability 2**-k) Returns False if the number if composite, and True if it's probably prime. gà?ii(RR&R(R/R+R9R5R6(RtkRtttiR'((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytrandomized_primality_testing¼s  cCst|dƒotStS(s>Returns True if the number is prime, and False otherwise. i(R=R6R5(R((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytis_primeÎs cCsTtti|dƒƒ}x4to,t|ƒ}|dO}t|ƒoPqqW|S(sxReturns a prime number of max. 'math.ceil(nbits/8)*8' bits. In other words: nbits is rounded up to whole bytes. g @i(R%R&RR6R$R>(R!R"R((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytgetprimeàs   cCst||ƒ}|djS(sQReturns True if a and b are relatively prime, and False if they are not. i(R(RR3td((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytare_relatively_primeôscCsCt|ƒ}x*to"t|ƒ}||jpPqqW||fS(s5Returns a tuple of two different primes of nbits bits(R?R6(R!RR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytfind_p_qüs   cCsh|djo|ddfSt||ƒ}t||ƒ}t||ƒ\}}}|||||fS(s@Returns a tuple (d, i, j) such that d = gcd(a, b) = ia + jb ii(Rtlongtextended_euclid_gcd(RR3RtrR@R:tl((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyRDs  c Csä||}|d|d}xJtoBttd|dƒƒ}t||ƒot||ƒoPqqWt||ƒ\}}}|djptd||fƒ‚n|||djptd|||fƒ‚n||fS(saCalculates an encryption and a decryption key for p and q, and returns them as a tuple (e, d)iiis.e (%d) and phi_n (%d) are not relatively primes6e (%d) and i (%d) are not mult. inv. modulo phi_n (%d)(R6R?R)RARDt Exception( RRR!Rtphi_nteR@R<R7((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytcalculate_keyss   cCs[xHto@t|ƒ\}}t|||ƒ\}}|djoPqqW||||fS(s|Generate RSA keys of nbits bits. Returns (p, q, e, d). Note: this can take a long time, depending on the key size. i(R6RBRJ(R!RRRIR@((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytgen_keys,s cCsIt|ƒ\}}}}h|d6||d6h|d6|d6|d6fS(sÌGenerates public and private keys, and returns them as (pub, priv). The public key consists of a dict {e: ..., , n: ....). The private key consists of a dict {d: ...., p: ...., q: ....). RIRR@RR(RK(R!RRRIR@((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytgen_pubpriv_keys<scCs·t|ƒtijott|ƒ||ƒSt|ƒtij otdƒ‚n|djoGtiti |dƒƒtiti |dƒƒjot dƒ‚nt |||ƒS(sDEncrypts a message using encryption key 'ekey', working modulo nsYou must pass a long or an intiisThe message is too long( RRRt encrypt_intRCRR R&tfloorR(t OverflowErrorR(tmessagetekeyR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyRMHs 7cCst|||ƒS(sLDecrypts a cypher text using the decryption key 'dkey', working modulo n(RM(t cyphertexttdkeyR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt decrypt_intXscCst|||ƒS(s2Signs 'message' using key 'dkey', working modulo n(RT(RPRSR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytsign_int^scCst|||ƒS(s4verifies 'signed' using key 'ekey', working modulo n(RM(tsignedRQR((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt verify_intcscCs.tit|ƒƒ}ti|ƒ}|iƒS(s-Pickles and base64encodes it's argument chops(tzlibtcompressRtbase64t encodestringtstrip(tchopstvaluetencoded((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt picklechopshscCsttiti|ƒƒƒS(s:base64decodes and unpickes it's argument string into chops(RRXt decompressRZt decodestring(R((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt unpicklechopsoscCsÑt|ƒ}|d}ttiti|dƒƒƒ}|d}||}||djo|d7}ng} xTt|ƒD]F} | |} || | |!} t| ƒ} | i|| ||ƒƒq}Wt| ƒS(sºSplits 'message' into chops that are at most as long as n, converts these into integers, and calls funcref(integer, key, n) for each chop. Used by 'encrypt' and 'sign'. iiii( tlenR%R&RNR(R/RRR`(RPtkeyRtfuncreftmsglentmbitsR!R"tblockstcyphertbindextoffsettblockR^((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt chopstringts  !     cCsId}t|ƒ}x0|D](}||||ƒ}|t|ƒ7}qW|S(s…Glues chops back together into a string. calls funcref(integer, key, n) for each chop. Used by 'decrypt' and 'verify'. R(RcR(R]ReRRfRPtcparttmpart((s3/usr/lib/python2.6/site-packages/rsa/_version133.pyt gluechopss cCst||d|dtƒS(s5Encrypts a string 'message' with the public key 'key'RIR(RnRM(RPRe((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytencryptŸscCs#t||d|d|dtƒS(s3Signs a string 'message' with the private key 'key'R@RR(RnRT(RPRe((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytsign¤scCs#t||d|d|dtƒS(s,Decrypts a cypher with the private key 'key'R@RR(RqRT(RjRe((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytdecrypt©scCst||d|dtƒS(s+Verifies a cypher with the public key 'key'RIR(RqRM(RjRe((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytverify®st__main__RLRrRtRsRu(8t__doc__t __author__t__date__t __version__tcPickletpicklet ImportErrorRRRZR&RR*tsysRRXt rsa._compatRtwarningstwarnt__name__tDeprecationWarningRRRRR$RR+R2R4R9R=R>R?RARBRDRJRKRLRMRTRURWR`RcRnRqRrRsRtRutdoctestttestmodt__all__(((s3/usr/lib/python2.6/site-packages/rsa/_version133.pytsp