+
    oiG                         R t ^ RIt ! R R]4      tR R ltR R ltR R	 ltR
 R ltR R ltR R lt	]
R8X  d   ^ RIt]P                  ! 4        R# R# )z/Common functionality shared by several modules.Nc                   B   a a ] tR t^t oRV3R lV 3R llltRtVtV ;t# )NotRelativePrimeErrorc          
      6   < V ^8  d   QhRS[ RS[ RS[ RS[RR/# )   abdmsgreturnN)intstr)format__classdict__s   "m/Users/tonyclaw/.openclaw/workspace/scripts/youtube-playlists/venv/lib/python3.14/site-packages/rsa/common.py__annotate__"NotRelativePrimeError.__annotate__   s0      # # # C      c                p   < \         ST `  T;'       g    R WV3,          4       Wn        W n        W0n        R# )z.%d and %d are not relatively prime, divider=%iN)super__init__r   r   r   )selfr   r   r   r	   	__class__s   &&&&&r   r   NotRelativePrimeError.__init__   s4    \\ PTUZ[S\ \]r   )r   r   r   ) )__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classcell__)r   r   s   @@r   r   r      s       r   r   c                0    V ^8  d   QhR\         R\         /# )r   numr
   r   )r   s   "r   r   r      s     \ \# \# \r   c                     V P                  4       #   \         d"   p\        R\        T 4      ,          4      ThRp?ii ; i)a  
Number of bits needed to represent a integer excluding any prefix
0 bits.

Usage::

    >>> bit_size(1023)
    10
    >>> bit_size(1024)
    11
    >>> bit_size(1025)
    11

:param num:
    Integer value. If num is 0, returns 0. Only the absolute value of the
    number is considered. Therefore, signed integers will be abs(num)
    before the number's bit length is determined.
:returns:
    Returns the number of bits in the integer.
z,bit_size(num) only supports integers, not %rN)
bit_lengthAttributeError	TypeErrortype)r"   exs   & r   bit_sizer*      s?    ,\~~ \FcRSY[[\s    >9>c                0    V ^8  d   QhR\         R\         /# )r   numberr
   r#   )r   s   "r   r   r   8   s     ) )c )c )r   c                >    V ^ 8X  d   ^# \        \        V 4      ^4      # )a\  
Returns the number of bytes required to hold a specific long number.

The number of bytes is rounded up.

Usage::

    >>> byte_size(1 << 1023)
    128
    >>> byte_size((1 << 1024) - 1)
    128
    >>> byte_size(1 << 1024)
    129

:param number:
    An unsigned integer
:returns:
    The number of bytes required to hold a specific long number.
)ceil_divr*   )r,   s   &r   	byte_sizer/   8   s     ( {HV$a((r   c                <    V ^8  d   QhR\         R\         R\         /# )r   r"   divr
   r#   )r   s   "r   r   r   Q   s!      # C C r   c                B    \        W4      w  r#V'       d
   V^,          pV# )aF  
Returns the ceiling function of a division between `num` and `div`.

Usage::

    >>> ceil_div(100, 7)
    15
    >>> ceil_div(100, 10)
    10
    >>> ceil_div(1, 4)
    1

:param num: Division's numerator, a number
:param div: Division's divisor, a number

:return: Rounded up result of the division between the parameters.
)divmod)r"   r1   quantamods   &&  r   r.   r.   Q   s!    $ "KF
!Mr   c          	      |    V ^8  d   QhR\         R\         R\        P                  \         \         \         3,          /# )r   r   r   r
   )r   typingTuple)r   s   "r   r   r   i   s0      C C FLLc3$? r   c                    ^ p^p^p^ pT pTpV^ 8w  d4   W,          pYV,          rWHV,          ,
          TrBWXV,          ,
          TrSK:  V^ 8  d	   WG,          pV^ 8  d	   WV,          pWV3# )z;Returns a tuple (r, i, j) such that r = gcd(a, b) = ia + jb )	r   r   xylxlyoaobqs	   &&       r   extended_gcdrB   i   sy     	
A	A	
B	
B	
B	
B
q&FUAa%L1Ba%L1B	Av
	Av
"9r   c                <    V ^8  d   QhR\         R\         R\         /# )r   r;   nr
   r#   )r   s   "r   r   r      s!      s s s r   c                H    \        W4      w  r#pV^8w  d   \        WV4      hV# )z}Returns the inverse of x % n under multiplication, a.k.a x^-1 (mod n)

>>> inverse(7, 4)
3
>>> (inverse(143, 4) * 143) % 4
1
)rB   r   )r;   rD   dividerinv_s   &&   r   inverserI      s,     %Q*W1!|#A'22Jr   c                    V ^8  d   QhR\         P                  \        ,          R\         P                  \        ,          R\        /# )r   a_valuesmodulo_valuesr
   )r7   Iterabler   )r   s   "r   r   r      s4        &//#&  vs7K  PS  r   c                    ^p^ pV F  pW$,          pK  	  \        W4       F5  w  rVW%,          p\        Wu4      pW6V,          V,          ,           V,          pK7  	  V# )aY  Chinese Remainder Theorem.

Calculates x such that x = a[i] (mod m[i]) for each i.

:param a_values: the a-values of the above equation
:param modulo_values: the m-values of the above equation
:returns: x such that x = a[i] (mod m[i]) for each i


>>> crt([2, 3], [3, 5])
8

>>> crt([2, 3, 2], [3, 5, 7])
23

>>> crt([2, 3, 0], [7, 11, 15])
135
)ziprI   )	rK   rL   mr;   modulom_ia_iM_irG   s	   &&       r   crtrU      s_    ( 	
A	A	   -2
hcsS A%	 3 Hr   __main__)__doc__r7   
ValueErrorr   r*   r/   r.   rB   rI   rU   r   doctesttestmodr:   r   r   <module>r[      sU    6 J \8)200" F zOO r   