%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/
Upload File :
Create Path :
Current File : //proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyc

�
�ac�@ s�ddlmZddlmZmZddlmZyeWnek
rWe	ZnXy ddl
mZeZ
eZWnKek
r�eZ
yddlmZeZWq�ek
r�eZq�XnXddlZddlZdefd��YZd	efd
��YZdefd��YZd
�Zd�Zd�Zd�Zd�Zd�Ze
rhd�Znerzd�Zn	d�Zy
ej Z!Wne"k
r�d�Z!nXd�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$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�g�Z/d�a0dS(�i����(tdivision(t
integer_typestPY3(treduce(tpowmod(tmpzNtErrorcB seZdZRS(s)Base class for exceptions in this module.(t__name__t
__module__t__doc__(((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyR$stSquareRootErrorcB seZRS((RR(((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyR
)stNegativeExponentErrorcB seZRS((RR(((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyR-scC s?tjdt�|dkr/td|��nt|||�S(s+Raise base to exponent, reducing by modulussRFunction is unused in library code. If you use this code, change to pow() builtin.is#Negative exponents (%d) not allowed(twarningstwarntDeprecationWarningRtpow(tbasetexponenttmodulus((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytmodular_exp1s	
cC s�|ddkst�t|�dks.t�x�t|�t|�kr�|ddkr�xItdt|�d�D]+}|||d|||||<qsWn|dd!}q1W|S(s�Reduce poly by polymod, integer arithmetic modulo p.

  Polynomials are represented as lists of coefficients
  of increasing powers of x.i����iii(tAssertionErrortlentxrange(tpolytpolymodtpti((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytpolynomial_reduce_mod<s
 ,cC s�t|�t|�ddg}xatt|��D]M}xDtt|��D]0}|||||||||||<qMWq4Wt|||�S(s�Polynomial multiplication modulo a polynomial over ints mod p.

  Polynomials are represented as lists of coefficients
  of increasing powers of x.ii(RRR(tm1tm2RRtprodRtj((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytpolynomial_multiply_modSs

!2cC s�||kst�|dkr%dgS|}|}|ddkrJ|}n	dg}xW|dkr�|d}t||||�}|ddkrVt||||�}qVqVW|S(s�Polynomial exponentiation modulo a polynomial over ints mod p.

  Polynomials are represented as lists of coefficients
  of increasing powers of x.iii(RR (RRRRtGtkts((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytpolynomial_exp_modks		
cC s|dkst�|ddks(t�||}|dkrBdS|dkrRdS|d}}x)|ddkr�|d|d}}qbW|ddks�|ddks�|ddkr�d}nd}|dkr�|S|ddkr|ddkr|}n|t|||�S(	s
Jacobi symboliiiiiii����i(Rtjacobi(tatnta1teR#((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyR%�s$	

0	 
cC s�d|ko|kns"t�d|ks4t�|dkrDdS|dkrT|St||�}|dkr�td||f��n|ddkr�t||dd|�S|dd	krEt||dd|�}|dkr�t||dd|�S||dkr6d|td||d	d|�|Std
��ntrT|}ntd|�}x�td|�D]r}t||d||�dkrs||df}td|dd||�}|ddks�t�|dSqsWtd��d
S(s)Modular square root of a, mod p, p prime.iiii����s%d has no square root modulo %diiiisShouldn't get here.i���sNo b found.N(ii(	RR%R
RtRuntimeErrorRtminRR$(R&Rtjactdt	range_toptbtftff((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytsquare_root_mod_prime�s:"(	!cC s |dkrdSt|d|�S(sInverse of a mod m.ii����(R(R&tm((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytinverse_mod�scC s�|dkrdSt|�}t|�}td�td�}}|||}}xH|dkr�||}||||||||f\}}}}qUW||S(sInverse of a mod m.ii(R(R&R3tlmthmtlowthightr((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyR4�s
2cC s�|dkrdSd\}}|||}}xH|dkrw||}||||||||f\}}}}q0W||S(sInverse of a mod m.ii(ii((R&R3R5R6R7R8R9((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyR4�s
2cC s"x|r|||}}qW|S(s1Greatest common divisor using Euclid's algorithm.((R&R/((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytgcd2s	cG sKt|�dkrtt|�St|dd�rCtt|d�S|dS(sLGreatest common divisor.

  Usage: gcd([ 2, 4, 6 ])
  or:    gcd(2, 4, 6)
  iit__iter__(RRR:thasattr(R&((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytgcd
s

cC s||t||�S(s&Least common multiple of two integers.(R=(R&R/((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytlcm2scG sKt|�dkrtt|�St|dd�rCtt|d�S|dS(sJLeast common multiple.

  Usage: lcm([ 3, 4, 5 ])
  or:    lcm(3, 4, 5)
  iiR;(RRR>R<(R&((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytlcms

cC s�t|t�st�|dkr%gSg}d}x�tD]�}||krNPnt||�\}}|dkr8d}xE||kr�|}t||�\}}|dkr�Pn|d}qxW|j||f�q8q8W|tdkr�t|�r	|j|df�q�td}x�|d}t||�\}}||krEPn|dkrd}|}xE||kr�t||�\}}|dkr�Pn|}|d}q`W|j||f�qqW|dkr�|j|df�q�n|S(s2Decompose n into a list of (prime,exponent) pairs.iiii����(t
isinstanceRRtsmallprimestdivmodtappendtis_prime(R'tresultR-tqR9tcount((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyt
factorization,sP


cC s�tjdt�t|t�s%t�|dkr5dSd}t|�}x[|D]S}|d}|dkr�||d|d|dd}qN||dd}qNW|S(s'Return the Euler totient function of n.sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsaiii(RR
RR@RRRH(R'RER1R0R)((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytphids	

%cC s tjdt�tt|��S(s�Return Carmichael function of n.

  Carmichael(n) is the smallest integer x such that
  m**x = 1 mod n for all m relatively prime to n.
  sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsa(RR
Rtcarmichael_of_factorizedRH(R'((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyt
carmichael|s	cC sstjdt�t|�dkr&dSt|d�}x6tdt|��D]}t|t||��}qLW|S(shReturn the Carmichael function of a number that is
  represented as a list of (prime,exponent) pairs.
  sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsaii(RR
RRtcarmichael_of_ppowerRR?(tf_listRER((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyRJ�s	cC sXtjdt�|\}}|dkr@|dkr@d|dS|d||dSdS(s=Carmichael function of the given power of the given prime.
  sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsaiiN(RR
R(tppRR&((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyRL�s	cC svtjdt�|dkr dSt||�dks;t�|}d}x(|dkrq|||}|d}qJW|S(s;Return the order of x in the multiplicative group mod m.
  sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsaii(RR
RR=R(txR3tzRE((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyt	order_mod�s	cC srtjdt�x[t||�}|dkr2Pn|}x/t||�\}}|dkr`Pn|}q;WqW|S(s8Return the largest factor of a relatively prime to b.
  sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsaii(RR
RR=RB(R&R/R-RFR9((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytlargest_factor_relatively_prime�s	cC s&tjdt�t|t||��S(syReturn the order of x in the multiplicative group mod m',
  where m' is the largest factor of m relatively prime to x.
  sxFunction is unused by library code. If you use this code, please open an issue in https://github.com/warner/python-ecdsa(RR
RRQRR(ROR3((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pytkinda_order_mod�s	c
C s�da|tdkr-|tkr&tStSnt|d!�dkrFtSd	}dttj|d��}xNd"d#d$d%d&d'd(d)d*d+d,d-fD]"\}}||kr�Pn|}q�Wd}|d}x(|ddkr�|d}|d}q�Wx�t|�D]�}t|}t	|||�}	|	dkr|	|dkrd}
xZ|
|dkr�|	|dkr�t	|	d|�}	|	dkr�|datS|
d}
qHW|	|dkr�|datSqqWtS(.s*Return True if x is prime, False otherwise.

  We use the Miller-Rabin test, as given in Menezes et al. p. 138.
  This test is not exact: there are composite values n for which
  it returns True.

  In testing the odd numbers from 10000001 to 19999999,
  about 66 composites got past the first test,
  5 got past the second test, and none got past the third.
  Since factors of 2, 3, 5, 7, and 11 were detected during
  preliminary screening, the number of numbers tested by
  Miller-Rabin was (19999999 - 10000001)*(2/3)*(4/5)*(6/7)
  = 4.57 million.
  ii����iiiiiii(idii�ii�ii�ii,i	i^ii�i�ii&i�iiRiiii�i	(idi(i�i(i�i(i�i(i,i	(i^i(i�i(i�i(i&i(i�i(iRi(ii(
tmiller_rabin_test_countRAtTruetFalseR=tinttmathtlogRR(R'tttn_bitsR"tttR#R9RR&tyR((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyRD�sX



#

cC s?|dkrdS|ddB}xt|�s:|d}q!W|S(s9Return the smallest prime larger than the starting value.ii(RD(tstarting_valueRE((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyt
next_prime8siiiiii
iiiiii%i)i+i/i5i;i=iCiGiIiOiSiYiaieigikimiqii�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iii
iiiii%i3i7i9i=iKiQi[i]iaigioiui{ii�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i	iii#i-i3i9i;iAiKiQiWiYi_ieiiikiwi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�iiiii)i+i5i7i;i=iGiUiYi[i_imiqisiwi�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�ii	iiii%i'i-i?iCiEiIiOiUi]iciiii�i�i�i�i�i�i�i�i�i�i�i(1t
__future__RtsixRRt	six.movesRRt	NameErrortrangetgmpy2RRUtGMPY2RVtGMPYtImportErrortgmpyRRXRt	ExceptionRR
RRRR R$R%R2R4R=R:tAttributeErrorR>R?RHRIRKRJRLRQRRRSRDR_RART(((sG/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/numbertheory.pyt<module>s�





				 		.	


				8							
	M	'$!

Zerion Mini Shell 1.0