+
    '(j<,                     @    ^RI Ht ^ RIHtHtHtHt  ! R R]4      tR# )   )IntegerBase)long_to_bytesbytes_to_longinverseGCDc                     a  ] tR t^$t o RtR tR tR tR tR t	R t
R6R lt]R7R	 l4       tR
 tR tR tR tR tR tR t]tR tR tR tR tR tR tR8R ltR8R ltR tR8R ltR t R t!R t"R t#R  t$R! t%R" t&R# t'R$ t(R% t)R& t*R' t+R( t,R) t-R* t.R+ t/R, t0R- t1R. t2R/ t3R0 t4R1 t5R2 t6]7R3 4       t8]7R4 4       t9R5t:V t;R# )9IntegerNativez3A class to model a natural integer (including zero)c                    \        V\        4      '       d   \        R 4      h VP                  V n        R#   \         d    Yn         R# i ; i)z-A floating point type is not a natural numberN)
isinstancefloat
ValueError_valueAttributeError)selfvalues   &&O/home/ubuntu/cf-venv/lib/python3.14/site-packages/Crypto/Math/_IntegerNative.py__init__IntegerNative.__init__'   s?    eU##LMM	 ,,DK 	 K	 s   6 A
Ac                    V P                   # Nr   r   s   &r   __int__IntegerNative.__int__0   s    {{    c                *    \        \        V 4      4      # r   )strintr   s   &r   __str__IntegerNative.__str__3   s    3t9~r   c                &    R \        V 4      ,          # )zInteger(%s))r   r   s   &r   __repr__IntegerNative.__repr__6   s    s4y((r   c                ,    \        V P                  4      # r   )hexr   r   s   &r   __hex__IntegerNative.__hex__:       4;;r   c                ,    \        V P                  4      # r   r   r   r   s   &r   	__index__IntegerNative.__index__>   r(   r   c                :   V P                   ^ 8  d   \        R4      h\        V P                   V4      p\        V4      Tu;8  d   ^ 8  d   M M\        R4      hVR8X  d    V# VR8X  d)   \	        V4      pVP                  4        \        V4      pV# \        R4      h)    .Conversion only valid for non-negative numberszValue too large to encodebiglittleIncorrect byteorder)r   r   r   len	bytearrayreversebytes)r   
block_size	byteorderresults   &&& r   to_bytesIntegerNative.to_bytesA   s    ;;?MNNt{{J7v;'a'899  ("v&FNN6]F  233r   c                    VR 8X  d   M.VR8X  d   \        V4      pVP                  4        M\        R4      hV ! \        V4      4      # )r0   r1   r2   )r4   r5   r   r   )clsbyte_stringr8   s   &&&r   
from_bytesIntegerNative.from_bytesQ   sG    ("#K0K!233=-..r   c                >    Vf   R# V P                   \        V4      8H  # )NFr   r   r   terms   &&r   __eq__IntegerNative.__eq__]   s    <{{c$i''r   c                .    V P                  V4      '       * # r   )rE   rC   s   &&r   __ne__IntegerNative.__ne__b       ;;t$$$r   c                2    V P                   \        V4      8  # r   rB   rC   s   &&r   __lt__IntegerNative.__lt__e   s    {{SY&&r   c                V    V P                  V4      ;'       g    V P                  V4      # r   )rL   rE   rC   s   &&r   __le__IntegerNative.__le__h   s"    {{4 55DKK$55r   c                .    V P                  V4      '       * # r   )rO   rC   s   &&r   __gt__IntegerNative.__gt__k   rJ   r   c                .    V P                  V4      '       * # r   )rL   rC   s   &&r   __ge__IntegerNative.__ge__n   rJ   r   c                     V P                   ^ 8g  # r.   r   r   s   &r   __nonzero__IntegerNative.__nonzero__q   s    {{ar   c                     V P                   ^ 8  # rX   r   r   s   &r   is_negativeIntegerNative.is_negativeu   s    {{Qr   c                     V P                  V P                  \        V4      ,           4      #   \        \        \
        3 d
    \        u # i ; ir   	__class__r   r   r   r   	TypeErrorNotImplementedrC   s   &&r   __add__IntegerNative.__add__y   ?    	">>$++D	"9::NI6 	"!!	"   *- AAc                     V P                  V P                  \        V4      ,
          4      #   \        \        \
        3 d
    \        u # i ; ir   r_   rC   s   &&r   __sub__IntegerNative.__sub__   re   rf   c                     V P                  V P                  \        V4      ,          4      #   \        \        \
        3 d
    \        u # i ; ir   r_   )r   factors   &&r   __mul__IntegerNative.__mul__   s?    	">>$++F";<<NI6 	"!!	"rf   c                X    V P                  V P                  \        V4      ,          4      # r   r`   r   r   )r   divisors   &&r   __floordiv__IntegerNative.__floordiv__   s    ~~dkkS\9::r   c                    \        V4      pV^ 8  d   \        R4      hV P                  V P                  V,          4      # )r.   Modulus must be positive)r   r   r`   r   )r   rp   divisor_values   && r   __mod__IntegerNative.__mod__   s7    G1788~~dkkM9::r   Nc                    \        V4      pV^ 8  d   \        R4      hVe1   \        V4      pV^ 8  d   \        R4      hV^ 8X  d   \        R4      hMRp\        V P                  W44      V n        V # )r.   zExponent must not be negativeNrt   Modulus cannot be zero)r   r   ZeroDivisionErrorpowr   )r   exponentmodulus	exp_value	mod_values   &&&  r   inplace_powIntegerNative.inplace_pow   sv    M	q=<==GI1} !;<<A~'(@AA  I$++y<r   c                F    V P                  V 4      pVP                  W4      # r   )r`   r   )r   r|   r}   r9   s   &&& r   __pow__IntegerNative.__pow__   s!    %!!(44r   c                ,    \        V P                  4      # r   )absr   r   s   &r   __abs__IntegerNative.__abs__   r(   r   c                &   V P                   pVfH   V^ 8  d   \        R4      hTpV^,           ^,          pWC8  d   TpW2V,          ,           ^,          pK   TpM*V^ 8:  d   \        R4      hV P                  W,          V4      pV P                  V4      # )NzSquare root of negative valuert   )r   r   _tonelli_shanksr`   )r   r}   r   xyr9   s   &&    r   sqrtIntegerNative.sqrt   s    ?qy !@AA AQ1A%!^)F!| !;<<))$.'BF~~f%%r   c                J    V ;P                   \        V4      ,          un         V # r   rB   rC   s   &&r   __iadd__IntegerNative.__iadd__       s4y r   c                J    V ;P                   \        V4      ,          un         V # r   rB   rC   s   &&r   __isub__IntegerNative.__isub__   r   r   c                J    V ;P                   \        V4      ,          un         V # r   rB   rC   s   &&r   __imul__IntegerNative.__imul__   r   r   c                    \        V4      pV^ 8X  d   \        R4      hV^ 8  d   \        R4      hV ;P                  V,          un        V # )r.   zDivision by zerort   )r   rz   r   r   )r   rD   r}   s   && r   __imod__IntegerNative.__imod__   sD    d)a<#$677Q;788wr   c                X    V P                  V P                  \        V4      ,          4      # r   ro   rC   s   &&r   __and__IntegerNative.__and__       ~~dkkCI566r   c                X    V P                  V P                  \        V4      ,          4      # r   ro   rC   s   &&r   __or__IntegerNative.__or__   r   r   c                     V P                  V P                  \        V4      ,	          4      #   \         d    T P                  ^ 8  d    ^ # Ru # i ; ir.   )r`   r   r   OverflowErrorr   poss   &&r   
__rshift__IntegerNative.__rshift__   sF    	>>$++S"9:: 	{{a			s   *- AAAc                     V ;P                   \        V4      ,          un         V #   \         d    T P                   ^ 8  d    ^ # Ru # i ; ir   )r   r   r   r   s   &&r   __irshift__IntegerNative.__irshift__   sE    	KKCH$K   	{{a			s   "& A
A
	A
c                     V P                  V P                  \        V4      ,          4      #   \         d    \	        R 4      hi ; izIncorrect shift count)r`   r   r   r   r   r   s   &&r   
__lshift__IntegerNative.__lshift__   s>    	6>>$++S"9:: 	6455	6s	   *- Ac                     V ;P                   \        V4      ,          un         V #   \         d    \        R 4      hi ; ir   )r   r   r   r   r   s   &&r   __ilshift__IntegerNative.__ilshift__   s=    	6KKCH$K   	6455	6s   "& =c                h   V P                   ^ 8  d   \        R4      h  V P                   VP                   ,	          ^,          pVP                   ^ 8  d   \        R4      h V#   \         d1    T P                   T,	          ^,          pT^ 8  d   \        R4      h T# i ; i  \         d    ^ p T# i ; i)r.   z)no bit representation for negative valuesznegative bit count)r   r   r   r   )r   nr9   s   && r   get_bitIntegerNative.get_bit   s    ;;?HII
	;++1Q688a<$%9::    " ;++*a/q5$%9::  ;  	F	s*   A A" "7BB  BB   B10B1c                .    V P                   ^,          ^8H  # r   r   r   s   &r   is_oddIntegerNative.is_odd      aA%%r   c                .    V P                   ^,          ^ 8H  # r   r   r   s   &r   is_evenIntegerNative.is_even  r   r   c                    V P                   ^ 8  d   \        R4      hV P                   ^ 8X  d   ^# V P                   P                  4       # )r.   r/   )r   r   
bit_lengthr   s   &r   size_in_bitsIntegerNative.size_in_bits  s;    ;;?MNN;;!{{%%''r   c                L    V P                  4       ^,
          ^,          ^,           # r   )r   r   s   &r   size_in_bytesIntegerNative.size_in_bytes  s     !!#a'A-11r   c                (   V P                   ^ 8  d   R# V P                   R9   d   R# V P                   ^,          pV^,          pW P                   8  d,   W P                   ,           ^V,          ,          pV^,          pK;  V P                   V^,          8H  # )r.   FT)r.   r   r   )r   r   square_xs   &  r   is_perfect_squareIntegerNative.is_perfect_square   sq    ;;?;;& KK16$KK'QU3AAvH{{a1f$$r   c                ^    V P                   \        V4      ,          ^ 8X  d   \        R4      hR# )r.   zValue is compositeN)r   r   r   )r   small_primes   &&r   fail_if_divisible_by"IntegerNative.fail_if_divisible_by/  s)    KK#k**q0122 1r   c                j    V ;P                   \        V4      \        V4      ,          ,          un         V # r   rB   )r   abs   &&&r   multiply_accumulate!IntegerNative.multiply_accumulate3  s!    s1vA&r   c                &    \        V4      V n        R # r   r*   )r   sources   &&r   setIntegerNative.set7  s    &kr   c                N    \        V P                  \        V4      4      V n        V # r   )r   r   r   )r   r}   s   &&r   inplace_inverseIntegerNative.inplace_inverse:  s    dkk3w<8r   c                J    V P                  V 4      pVP                  V4       V# r   )r`   r   )r   r}   r9   s   && r   r   IntegerNative.inverse>  s#    %w'r   c           
         V P                  \        \        V P                  4      \        \	        V4      4      4      4      # r   )r`   r   r   r   r   rC   s   &&r   gcdIntegerNative.gcdC  s)    ~~c#dkk"2CD	NCDDr   c                    \        V4      pV P                  ^ 8X  g   V^ 8X  d   V P                  ^ 4      # V P                  \        V P                  V,          V P	                  V4      P                  ,          4      4      # rX   )r   r   r`   r   r   rC   s   &&r   lcmIntegerNative.lcmF  s\    4y;;!tqy>>!$$~~c4;;#5$((4.:O:O"OPQQr   c                   \        V 4      p \        V4      pV^ 8:  d   \        R4      hV^,          ^ 8X  d   \        R4      hW,          p V ^8X  g   V^8X  d   ^# V ^ 8X  d   ^ # ^ pT pV^,          ^ 8X  d   V^,          pV^,          pK"  V^,          ^ 8X  d   ^pMV^,          R9   d   ^pMRpV^,          ^8X  d   V^,          ^8X  d   V) pW,          pV\        P                  WS4      ,          # )r.   zn must be a positive integerz#n must be odd for the Jacobi symbol)r      r   )r   r   r	   jacobi_symbol)r   r   ea1sn1s   &&    r   r   IntegerNative.jacobi_symbolL  s    FF6;<<Ea<BCC E6Q!V6Av!m1HBFAEa<AUf_AAq5A:"q&A+AV=..r666r   c                    V^ 8  d   \        R4      hV^ 8X  d   \        R4      hV^,          ^ 8X  d   \        R4      h\        \        V4      4      p\        W,          V,          V4      # )r.   rt   ry   zOdd modulus is required)r   rz   r3   r   )term1term2r}   
number_lens   &&& r   _mult_modulo_bytes IntegerNative._mult_modulo_bytest  sc    Q;788a<#$<==aKA677w/0
emw6
CCr   r   )r.   r0   )r0   r   )<__name__
__module____qualname____firstlineno____doc__r   r   r   r"   r&   r+   r:   classmethodr?   rE   rH   rL   rO   rR   rU   rY   __bool__r\   rc   rh   rl   rq   rv   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   staticmethodr   r   __static_attributes____classdictcell__)__classdict__s   @r   r	   r	   $   s9    = )    / /(
%'6%% H""";; 5 &*776"&&(2%3"
ER %7 %7N 	D 	Dr   r	   N)_IntegerBaser   Crypto.Util.numberr   r   r   r   r	    r   r   <module>r      s    > & I IZDK ZDr   