+
    '(jl                        ^ RI t ^ RIt^ RIHt ^ RIHtHtHtHtH	t	 ^RI
Ht Rt] P                  R8X  d	   ]! R4      h]! R]4      tR	RR
]/t]! ]R4      '       d	   ]! R4      h ! R R]4      t]! 4       t]R
,          R8X  d-   ^ RIHtHtHtHt  ! R R]4      tR t]]P8                  n        M	^ RIHt R t^]P>                  ! R4      ,          t  ! R R]4      t!R# )    N)is_native_int)backendload_libc_ulongc_size_tc_uint8_ptr)IntegerBasea  typedef unsigned long UNIX_ULONG;
        typedef struct { int a; int b; void *c; } MPZ;
        typedef MPZ mpz_t[1];
        typedef UNIX_ULONG mp_bitcnt_t;

        void __gmpz_init (mpz_t x);
        void __gmpz_init_set (mpz_t rop, const mpz_t op);
        void __gmpz_init_set_ui (mpz_t rop, UNIX_ULONG op);

        UNIX_ULONG __gmpz_get_ui (const mpz_t op);
        void __gmpz_set (mpz_t rop, const mpz_t op);
        void __gmpz_set_ui (mpz_t rop, UNIX_ULONG op);
        void __gmpz_add (mpz_t rop, const mpz_t op1, const mpz_t op2);
        void __gmpz_add_ui (mpz_t rop, const mpz_t op1, UNIX_ULONG op2);
        void __gmpz_sub_ui (mpz_t rop, const mpz_t op1, UNIX_ULONG op2);
        void __gmpz_addmul (mpz_t rop, const mpz_t op1, const mpz_t op2);
        void __gmpz_addmul_ui (mpz_t rop, const mpz_t op1, UNIX_ULONG op2);
        void __gmpz_submul_ui (mpz_t rop, const mpz_t op1, UNIX_ULONG op2);
        void __gmpz_import (mpz_t rop, size_t count, int order, size_t size,
                            int endian, size_t nails, const void *op);
        void * __gmpz_export (void *rop, size_t *countp, int order,
                              size_t size,
                              int endian, size_t nails, const mpz_t op);
        size_t __gmpz_sizeinbase (const mpz_t op, int base);
        void __gmpz_sub (mpz_t rop, const mpz_t op1, const mpz_t op2);
        void __gmpz_mul (mpz_t rop, const mpz_t op1, const mpz_t op2);
        void __gmpz_mul_ui (mpz_t rop, const mpz_t op1, UNIX_ULONG op2);
        int __gmpz_cmp (const mpz_t op1, const mpz_t op2);
        void __gmpz_powm (mpz_t rop, const mpz_t base, const mpz_t exp, const
                          mpz_t mod);
        void __gmpz_powm_ui (mpz_t rop, const mpz_t base, UNIX_ULONG exp,
                             const mpz_t mod);
        void __gmpz_pow_ui (mpz_t rop, const mpz_t base, UNIX_ULONG exp);
        void __gmpz_sqrt(mpz_t rop, const mpz_t op);
        void __gmpz_mod (mpz_t r, const mpz_t n, const mpz_t d);
        void __gmpz_neg (mpz_t rop, const mpz_t op);
        void __gmpz_abs (mpz_t rop, const mpz_t op);
        void __gmpz_and (mpz_t rop, const mpz_t op1, const mpz_t op2);
        void __gmpz_ior (mpz_t rop, const mpz_t op1, const mpz_t op2);
        void __gmpz_clear (mpz_t x);
        void __gmpz_tdiv_q_2exp (mpz_t q, const mpz_t n, mp_bitcnt_t b);
        void __gmpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d);
        void __gmpz_mul_2exp (mpz_t rop, const mpz_t op1, mp_bitcnt_t op2);
        int __gmpz_tstbit (const mpz_t op, mp_bitcnt_t bit_index);
        int __gmpz_perfect_square_p (const mpz_t op);
        int __gmpz_jacobi (const mpz_t a, const mpz_t b);
        void __gmpz_gcd (mpz_t rop, const mpz_t op1, const mpz_t op2);
        UNIX_ULONG __gmpz_gcd_ui (mpz_t rop, const mpz_t op1,
                                     UNIX_ULONG op2);
        void __gmpz_lcm (mpz_t rop, const mpz_t op1, const mpz_t op2);
        int __gmpz_invert (mpz_t rop, const mpz_t op1, const mpz_t op2);
        int __gmpz_divisible_p (const mpz_t n, const mpz_t d);
        int __gmpz_divisible_ui_p (const mpz_t n, UNIX_ULONG d);

        size_t __gmpz_size (const mpz_t op);
        UNIX_ULONG __gmpz_getlimbn (const mpz_t op, size_t n);
        win32zNot using GMP on Windowsgmplibraryapi__mpir_versionzMPIR library detectedc                   &   a  ] tR t^nt o R tRtV tR# )_GMPc                   VP                  R 4      '       d   RVR,          ,           pM:VP                  R4      '       d   RVR,          ,           pM\        RV,          4      h\        \        V4      p\	        WV4       V# )mpz___gmpz_:   NNgmp___gmp_zAttribute %s is invalid)
startswithAttributeErrorgetattrlibsetattr)selfname	func_namefuncs   &&  L/home/ubuntu/cf-venv/lib/python3.14/site-packages/Crypto/Math/_IntegerGMP.py__getattr___GMP.__getattr__p   sh    ??6""!DH,I__V$$ 48+I !:T!ABBsI&D!     N)__name__
__module____qualname____firstlineno__r!   __static_attributes____classdictcell____classdict__s   @r    r   r   n   s     	 	r#   r   ctypes)	Structurec_intc_void_pbyrefc                   ,    ] tR t^tR]3R]3R]3.tRtR# )_MPZ	_mp_alloc_mp_size_mp_dr$   N)r%   r&   r'   r(   r/   r0   _fields_r)   r$   r#   r    r3   r3      s!     %('h')r#   r3   c                  (    \        \        4       4      # N)r1   r3   r$   r#   r    new_mpzr:      s    TV}r#   )ffic                  .    \         P                  ! R 4      # )zMPZ*)r;   newr$   r#   r    r:   r:      s    wwvr#   Pc                     a  ] tR t^t o Rt]! 4       t]P                  ]]	! ^ 4      4       R t
R tR tR tR tR tR8R lt]R9R	 l4       tR
 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!R:R lt"R:R lt#R t$R:R l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* t3R+ t4R, t5R- t6R. t7R/ t8R0 t9R1 t:R2 t;R3 t<]R4 4       t=]R5 4       t>R6 t?R7t@V tAR# );
IntegerGMPz#A fast, arbitrary precision integerc           	     2   \        4       V n        RV n        \        V\        4      '       d   \        R4      h\        V4      '       Edg   \        P                  V P                  4       RV n        V^ 8X  d   R# \        4       p\        P                  V4        V^ 8  p\        V4      pVP                  4       ^,
          ^ ,          ^,           pV^ 8  d   V^,
          p\        P                  V\        RWE^ ,          ,	          ,          4      4       \        P                  W"\        V^ ,          4      4       \        P                  V P                  V P                  V4       K   \        P                  V4       V'       g-   \        P!                  V P                  V P                  4       R# R# \        V\"        4      '       d4   \        P%                  V P                  VP                  4       RV n        R# \&        h  \        P                  T4       i ; i)z*Initialize the integer to the given value.Fz-A floating point type is not a natural numberTN    )r:   _mpz_p_initialized
isinstancefloat
ValueErrorr   _gmpmpz_initabs
bit_length
mpz_set_uir   mpz_mul_2expmpz_add	mpz_clearmpz_negr@   mpz_init_setNotImplementedError)r   valuetmppositivereduceslotss   &&    r    __init__IntegerGMP.__init__   s|    i!eU##LMMMM$++& $Dz)CMM#$ A:U**,q0R7!;ai!AIEOOC$+J&RZ:P,Q$RT%%c
0CDLLdkk3?   s#T[[$++6  z**dkk5<<8 $D%% s#s   CG? ?Hc                   \        4       p\        P                  WP                  4        ^ p^ p\        P	                  WP
                  4      ^ 8w  d]   \        P                  V4      R,          pW$V^ ,          ,          ,          p\        P                  W\        ^ 4      4       V^,           pK   \        P                  V4       V ^ 8  d   V) p\        V4      #   \        P                  T4       i ; i)r   rB   )r:   rH   rQ   rC   mpz_cmp_zero_mpz_p
mpz_get_uimpz_tdiv_q_2expr   rO   int)r   rT   rS   slotlsbs   &    r    __int__IntegerGMP.__int__   s    i#{{+		 ED,,s$4$45:ooc*Z7++$$Swr{;ax	 ; NN3!8FE5z	 NN3s   BC C1c                *    \        \        V 4      4      # r9   )strr_   r   s   &r    __str__IntegerGMP.__str__       3t9~r#   c                &    R \        V 4      ,          # )zInteger(%s))re   rf   s   &r    __repr__IntegerGMP.__repr__   s    s4y((r#   c                *    \        \        V 4      4      # r9   )hexr_   rf   s   &r    __hex__IntegerGMP.__hex__   ri   r#   c                    \        V 4      # r9   )r_   rf   s   &r    	__index__IntegerGMP.__index__   s    4yr#   c                D   V ^ 8  d   \        R4      h\        P                  V P                  4      p\        ^ 8X  d   Rp\        ^W1^,           ^,          4      pM3\        ^@8X  d   Rp\        ^W1^,           ^,          4      pM\        R4      h\        V4       Uu. uF0  p\        P                  V P                  W5,
          ^,
          4      NK2  	  pp\        P                  ! RWC,          ,           .VO5!  p\        V4      V,
          pV^ 8X  d   VP                  R4      pM@V^ 8  d"   VRV RV,          8w  d   \        R4      hWxR pMV^ 8  d   RV) ,          V,           pVR	8X  d   VRRR1,          pMVR
8X  d   M\        R4      h\        V4      ^ 8X  d   RpV# u upi )a2  Convert the number into a byte string.

This method encodes the number in network order and prepends
as many zero bytes as required. It only works for non-negative
values.

:Parameters:
  block_size : integer
    The exact size the output byte string must have.
    If zero, the string has the minimal length.
  byteorder : string
    'big' for big-endian integers (default), 'little' for litte-endian.
:Returns:
  A byte string.
:Raise ValueError:
  If the value is negative or if ``block_size`` is
  provided and the length of the byte string would exceed it.
.Conversion only valid for non-negative numbersLQzUnknown limb size>    Nz@Number is too big to convert to byte string of prescribed lengthlittlebigIncorrect byteorder)rG   rH   mpz_sizerC   	_sys_bitsmaxrangempz_getlimbnstructpacklenlstrip)	r   
block_size	byteorder	num_limbsspcharilimbsresult
cutoff_lens	   &&&      r    to_bytesIntegerGMP.to_bytes   s   ( !8MNNMM$++.	?FAy>a*?@I"_FAy>a*?@I011 MRR[L\]L\q""4;;	0ABL\]S6#55>>[:-
?]]7+F!^kz"g&<<  "D E EK(F!^,v5F DbD\F%233v;!F1 ^s   6Fc                ,   \        ^ 4      pVR8X  d   M.VR8X  d   \        V 4      p V P                  4        M\        R4      h\        P                  VP                  \        \        V 4      4      ^\        ^4      ^ \        ^ 4      \        V 4      4       V# )aF  Convert a byte string into a number.

:Parameters:
  byte_string : byte string
    The input number, encoded in network order.
    It can only be non-negative.
  byteorder : string
    'big' for big-endian integers (default), 'little' for litte-endian.

:Return:
  The ``Integer`` object carrying the same value as the input.
r{   rz   r|   )
r@   	bytearrayreverserG   rH   
mpz_importrC   r   r   r   )byte_stringr   r   s   && r    
from_bytesIntegerGMP.from_bytes(  s     A("#K0K!233 [!12  #K0	2 r#   c                ~    \        V\        4      '       g   \        V4      pV! V P                  VP                  4      # r9   )rE   r@   rC   )r   r   terms   &&&r    _apply_and_returnIntegerGMP._apply_and_returnI  s.    $
++d#DDKK--r#   c                    \        V\        4      '       g   \        V4      '       g   R # V P                  \        P
                  V4      ^ 8H  # )FrE   r@   r   r   rH   r[   r   r   s   &&r    __eq__IntegerGMP.__eq__N  s8    4,,d0C0C%%dllD9Q>>r#   c                    \        V\        4      '       g   \        V4      '       g   R # V P                  \        P
                  V4      ^ 8g  # )Tr   r   s   &&r    __ne__IntegerGMP.__ne__S  s8    4,,d0C0C%%dllD9Q>>r#   c                H    V P                  \        P                  V4      ^ 8  # r   r   rH   r[   r   s   &&r    __lt__IntegerGMP.__lt__X      %%dllD9A==r#   c                H    V P                  \        P                  V4      ^ 8*  # r   r   r   s   &&r    __le__IntegerGMP.__le__[      %%dllD9Q>>r#   c                H    V P                  \        P                  V4      ^ 8  # r   r   r   s   &&r    __gt__IntegerGMP.__gt__^  r   r#   c                H    V P                  \        P                  V4      ^ 8  # r   r   r   s   &&r    __ge__IntegerGMP.__ge__a  r   r#   c                \    \         P                  V P                  V P                  4      ^ 8g  # r   rH   r[   rC   r\   rf   s   &r    __nonzero__IntegerGMP.__nonzero__d  s"    ||DKK)9)9:a??r#   c                \    \         P                  V P                  V P                  4      ^ 8  # r   r   rf   s   &r    is_negativeIntegerGMP.is_negativeh  s"    ||DKK)9)9:Q>>r#   c                    \        ^ 4      p\        V\         4      '       g    \        V4      p\        P                  VP                  V P                  VP                  4       V#   \         d
    \        u # i ; ir   )r@   rE   rR   NotImplementedrH   rN   rC   r   r   r   s   && r    __add__IntegerGMP.__add__l  g    A$
++&!$' 	V]][[[[	"  ' &%%&   A% %A98A9c                    \        ^ 4      p\        V\         4      '       g    \        V4      p\        P                  VP                  V P                  VP                  4       V#   \         d
    \        u # i ; ir   )r@   rE   rR   r   rH   mpz_subrC   r   s   && r    __sub__IntegerGMP.__sub__x  r   r   c                    \        ^ 4      p\        V\         4      '       g    \        V4      p\        P                  VP                  V P                  VP                  4       V#   \         d
    \        u # i ; ir   )r@   rE   rR   r   rH   mpz_mulrC   r   s   && r    __mul__IntegerGMP.__mul__  r   r   c                <   \        V\        4      '       g   \        V4      p\        P                  VP                  V P
                  4      ^ 8X  d   \        R4      h\        ^ 4      p\        P                  VP                  V P                  VP                  4       V# )r   Division by zero)rE   r@   rH   r[   rC   r\   ZeroDivisionError
mpz_fdiv_q)r   divisorr   s   && r    __floordiv__IntegerGMP.__floordiv__  sx    ':.. )G<<((*-./#$677A	( r#   c                d   \        V\        4      '       g   \        V4      p\        P                  VP                  V P
                  4      pV^ 8X  d   \        R4      hV^ 8  d   \        R4      h\        ^ 4      p\        P                  VP                  V P                  VP                  4       V# r   r   Modulus must be positive	rE   r@   rH   r[   rC   r\   r   rG   mpz_mod)r   r   compr   s   &&  r    __mod__IntegerGMP.__mod__  s    ':.. )G||GNN ,,.19#$677!8788AV]][[^^	% r#   Nc           	     .   Vfd   V^ 8  d   \        R4      hVR8  d   \        R4      h\        P                  V P                  V P                  \	        \        V4      4      4       V # \        V\        4      '       g   \        V4      pV'       g   \        R4      hVP                  4       '       d   \        R4      h\        V4      '       dg   V^ 8  d   \        R4      hVR8  dB   \        P                  V P                  V P                  \	        V4      VP                  4       V # \        V4      pM!VP                  4       '       d   \        R4      h\        P                  V P                  V P                  VP                  VP                  4       V # )NzExponent must not be negative   zExponent is too bigr   r      )rG   rH   
mpz_pow_uirC   r   r_   rE   r@   r   r   r   mpz_powm_uimpz_powm)r   exponentmoduluss   &&&r    inplace_powIntegerGMP.inplace_pow  sH   ?!| !@AA #~ !677OODKK KK#CM28 - gz22$W-'(:;;""$$ !;<<X&&a<$%DEEe#$$T[[%)[[%,X%6%,^^5  K%h/%%'' !@AAMM$++++"//!..* r#   c                :    \        V 4      pVP                  W4      # r9   )r@   r   )r   r   r   r   s   &&& r    __pow__IntegerGMP.__pow__  s    D!!!(44r#   c                p    \        ^ 4      p\        P                  VP                  V P                  4       V# r   )r@   rH   mpz_absrC   )r   r   s   & r    __abs__IntegerGMP.__abs__  s&    AV]]DKK0r#   c                0   VfJ   V ^ 8  d   \        R4      h\        ^ 4      p\        P                  VP                  V P                  4       V# V^ 8:  d   \        R4      h\        V4      p\        V P                  \        V 4      V,          V4      4      pV# )z?Return the largest Integer that does not
exceed the square rootzSquare root of negative valuer   )rG   r@   rH   mpz_sqrtrC   r_   _tonelli_shanksr   r   r   s   && r    sqrtIntegerGMP.sqrt  s     ?ax !@AA]FMM&--++'  !| !;<<'lG 4 4SY5H' RSFr#   c                   \        V4      '       d   ^ Tu;8:  d   R8  d:   M M6\        P                  V P                  V P                  \	        V4      4       V # RTu;8  d   ^ 8  d;   M M7\        P                  V P                  V P                  \	        V) 4      4       V # \        V4      p\        P                  V P                  V P                  VP                  4       V # r   r    )r   rH   
mpz_add_uirC   r   
mpz_sub_uir@   rN   r   s   &&r    __iadd__IntegerGMP.__iadd__      D 5  $ '/  q  $ '0 d#DT[[[[[[	" r#   c                   \        V4      '       d   ^ Tu;8:  d   R8  d:   M M6\        P                  V P                  V P                  \	        V4      4       V # RTu;8  d   ^ 8  d;   M M7\        P                  V P                  V P                  \	        V) 4      4       V # \        V4      p\        P                  V P                  V P                  VP                  4       V # r   )r   rH   r   rC   r   r   r@   r   r   s   &&r    __isub__IntegerGMP.__isub__  r   r#   c                   \        V4      '       d   ^ Tu;8:  d   R8  d:   M M6\        P                  V P                  V P                  \	        V4      4       V # RTu;8  d   ^ 8  de   M Ma\        P                  V P                  V P                  \	        V) 4      4       \        P                  V P                  V P                  4       V # \        V4      p\        P                  V P                  V P                  VP                  4       V # r   )r   rH   
mpz_mul_uirC   r   rP   r@   r   r   s   &&r    __imul__IntegerGMP.__imul__  s    D 5  $ '/  q  $ '0 T[[$++6d#DT[[[[[[	" r#   c                N   \        V\        4      '       g   \        V4      p\        P                  VP                  VP
                  4      pV^ 8X  d   \        R4      hV^ 8  d   \        R4      h\        P                  V P                  V P                  VP                  4       V # r   r   )r   r   r   s   && r    __imod__IntegerGMP.__imod__$  s    ':.. )G||GNN#//119#$677!8788T[[[[^^	% r#   c                    \        ^ 4      p\        V\         4      '       g   \        V4      p\        P                  VP                  V P                  VP                  4       V# r   )r@   rE   rH   mpz_andrC   r   s   && r    __and__IntegerGMP.__and__3  I    A$
++d#DV]][[[[	" r#   c                    \        ^ 4      p\        V\         4      '       g   \        V4      p\        P                  VP                  V P                  VP                  4       V# r   )r@   rE   rH   mpz_iorrC   r   s   && r    __or__IntegerGMP.__or__<  r  r#   c           	         \        ^ 4      pV^ 8  d   \        R4      hVR8  d   V ^ 8  d   R# ^ # \        P                  VP                  V P                  \        \        V4      4      4       V# r   znegative shift countr   r}   )r@   rG   rH   r^   rC   r   r_   r   posr   s   && r    
__rshift__IntegerGMP.__rshift__E  sb    A7344;ax	V]]![[$SX.	0 r#   c           	         V^ 8  d   \        R4      hVR8  d   V ^ 8  d   R# ^ # \        P                  V P                  V P                  \	        \        V4      4      4       V # r  )rG   rH   r^   rC   r   r_   r   r  s   &&r    __irshift__IntegerGMP.__irshift__S  sY    7344;ax	T[[![[$SX.	0 r#   c           	         \        ^ 4      p^ Tu;8:  d   R8  g   M \        R4      h\        P                  VP                  V P                  \        \        V4      4      4       V# r   r   zIncorrect shift count)r@   rG   rH   rM   rC   r   r_   r  s   && r    
__lshift__IntegerGMP.__lshift__`  sR    AC%455&--++!#c(+	- r#   c           	         ^ Tu;8:  d   R8  g   M \        R4      h\        P                  V P                  V P                  \	        \        V4      4      4       V # r  )rG   rH   rM   rC   r   r_   r  s   &&r    __ilshift__IntegerGMP.__ilshift__i  sI    C%455$++++!#c(+	- r#   c           
         V ^ 8  d   \        R4      hV^ 8  d   \        R4      hVR8  d   ^ # \        \        P                  V P                  \        \        V4      4      4      4      # )zHReturn True if the n-th bit is set to 1.
Bit 0 is the least significant.z)no bit representation for negative valuesznegative bit countr   )rG   boolrH   
mpz_tstbitrC   r   r_   )r   ns   &&r    get_bitIntegerGMP.get_bitq  s]     !8HIIq5122u9DOODKK$+CFO5 6 	6r#   c                H    \         P                  V P                  ^ 4      ^8H  # r   rH   r  rC   rf   s   &r    is_oddIntegerGMP.is_odd      t{{A.!33r#   c                H    \         P                  V P                  ^ 4      ^ 8H  # r   r#  rf   s   &r    is_evenIntegerGMP.is_even  r&  r#   c                f    V ^ 8  d   \        R4      h\        P                  V P                  ^4      # )z=Return the minimum number of bits that can encode the number.ru   )rG   rH   mpz_sizeinbaserC   rf   s   &r    size_in_bitsIntegerGMP.size_in_bits  s.     !8MNN""4;;22r#   c                L    V P                  4       ^,
          ^,          ^,           # )z>Return the minimum number of bytes that can encode the number.)r,  rf   s   &r    size_in_bytesIntegerGMP.size_in_bytes  s     !!#a'A-11r#   c                F    \         P                  V P                  4      ^ 8g  # r   )rH   mpz_perfect_square_prC   rf   s   &r    is_perfect_squareIntegerGMP.is_perfect_square  s    ((5::r#   c                P   \        V4      '       dZ   ^ Tu;8  d   R8  d@   M M<\        P                  V P                  \	        V4      4      '       d   \        R4      hR# \        V4      p\        P                  V P                  VP                  4      '       d   \        R4      hR# )z3Raise an exception if the small prime is a divisor.r   zThe value is compositeN)r   rH   mpz_divisible_ui_prC   r   rG   r@   mpz_divisible_p)r   small_primes   &&r    fail_if_divisible_byIntegerGMP.fail_if_divisible_by  s     %%;&&**4;;+2;+?A A$%=>>$[1K + 2 24 45664r#   c                   \        V\        4      '       g   \        V4      p\        V4      '       d   ^ Tu;8  d   R8  d:   M M6\        P	                  V P
                  VP
                  \        V4      4       V # RTu;8  d   ^ 8  d;   M M7\        P                  V P
                  VP
                  \        V) 4      4       V # \        V4      p\        P                  V P
                  VP
                  VP
                  4       V # )z/Increment the number by the product of a and b.r   r   )	rE   r@   r   rH   mpz_addmul_uirC   r   mpz_submul_ui
mpz_addmul)r   abs   &&&r    multiply_accumulateIntegerGMP.multiply_accumulate  s     !Z((1A1}u}""4;;#$88#*1:/ ~A~""4;;#$88#*A2;0 1A	" r#   c                    \        V\        4      '       g   \        V4      p\        P                  V P                  VP                  4       V # )z'Set the Integer to have the given value)rE   r@   rH   mpz_setrC   )r   sources   &&r    setIntegerGMP.set  s9     &*--'FT[[]]	$r#   c                t   \        V\        4      '       g   \        V4      p\        P                  VP                  V P
                  4      pV^ 8X  d   \        R4      hV^ 8  d   \        R4      h\        P                  V P                  V P                  VP                  4      pV'       g   \        R4      hV # )zmCompute the inverse of this number in the ring of
modulo integers.

Raise an exception if no inverse exists.
Modulus cannot be zeror   z No inverse value can be computed)	rE   r@   rH   r[   rC   r\   r   rG   
mpz_invert)r   r   r   r   s   &&  r    inplace_inverseIntegerGMP.inplace_inverse  s     ':.. )G||GNN ,,.19#$<==!8788!%!(1 ?@@r#   c                >    \        V 4      pVP                  V4       V# r9   )r@   rK  r   s   && r    inverseIntegerGMP.inverse  s    D!w'r#   c                N   \        ^ 4      p\        V4      '       dT   ^ Tu;8  d   R8  d:   M M6\        P                  VP                  V P                  \        V4      4       V# \        V4      p\        P                  VP                  V P                  VP                  4       V# )zMCompute the greatest common denominator between this
number and another term.i  )r@   r   rH   
mpz_gcd_uirC   r   mpz_gcdr   s   && r    gcdIntegerGMP.gcd  sw     A4% $ '/ d#DV]]DKK=r#   c                    \        ^ 4      p\        V\         4      '       g   \        V4      p\        P                  VP                  V P                  VP                  4       V# )zICompute the least common multiplier between this
number and another term.)r@   rE   rH   mpz_lcmrC   r   s   && r    lcmIntegerGMP.lcm  sE     A$
++d#DV]]DKK=r#   c                *   \        V \        4      '       g   \        V 4      p \        V\        4      '       g   \        V4      pV^ 8:  g   VP                  4       '       d   \        R4      h\        P                  V P                  VP                  4      # )zCompute the Jacobi symbolz,n must be positive odd for the Jacobi symbol)rE   r@   r(  rG   rH   
mpz_jacobirC   )r?  r  s   &&r    jacobi_symbolIntegerGMP.jacobi_symbol  sf     !Z((1A!Z((1A6QYY[[KLLqxx22r#   c                   \        V \        4      '       g   \        V 4      p \        V\        4      '       g   \        V4      p\        V\        4      '       g   \        V4      pV^ 8  d   \        R4      hV^ 8X  d   \        R4      hV^,          ^ 8X  d   \        R4      hW,          V,          pVP	                  VP                  4       4      # )r   r   rI  zOdd modulus is required)rE   r@   rG   r   r   r/  )term1term2r   products   &&& r    _mult_modulo_bytesIntegerGMP._mult_modulo_bytes  s    %,,u%E%,,u%E':.. )GQ;788a<#$<==aKA677=G+ 5 5 788r#   c                     V P                   e2   V P                  '       d    \        P                  V P                   4       R V n         R #   \         d     R # i ; ir9   )rC   rD   rH   rO   r   rf   s   &r    __del__IntegerGMP.__del__  sF    	{{&$$$NN4;;/DK 		s   A
 &A
 
AA)rD   rC   )r   r{   )r{   r9   )Br%   r&   r'   r(   __doc__r:   r\   rH   mpz_init_set_uir   rX   rb   rg   rk   ro   rr   r   staticmethodr   r   r   r   r   r   r   r   r   __bool__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/  r3  r9  rA  rF  rK  rN  rS  rW  r[  ra  rd  r)   r*   r+   s   @r    r@   r@      sc    -)Kgaj1'&T&):x  @.
?
?
>?>?@H?



%N5
$$$&64432;7,0
 	3 	3 9 9&	 	r#   r@   )"sysr   Crypto.Util.py3compatr   Crypto.Util._raw_apir   r   r   r   r   _IntegerBaser	   gmp_defsplatformImportErrorr   implementationhasattrobjectr   rH   r-   r.   r/   r0   r1   r3   r:   r   restyper;   calcsizer   r@   r$   r#   r    <module>rv     s   >   /B B &8t <<7
0
11uhUE73
3 !!
-
..6  v %H$88)y )
 !(D )
 $$	D
 D
r#   