OXIESEC PANEL
- Current Dir:
/
/
opt
/
gsutil
/
third_party
/
rsa
/
rsa
/
__pycache__
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/11/2025 08:19:48 AM
rwxr-xr-x
📄
__init__.cpython-39.pyc
1 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
_compat.cpython-39.pyc
3.71 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
common.cpython-39.pyc
3.86 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
core.cpython-39.pyc
1.18 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
key.cpython-39.pyc
22.54 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
machine_size.cpython-39.pyc
1.37 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
pem.cpython-39.pyc
2.29 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
pkcs1.cpython-39.pyc
11.44 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
prime.cpython-39.pyc
3.63 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
randnum.cpython-39.pyc
1.64 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
transform.cpython-39.pyc
4.89 KB
02/11/2025 08:19:48 AM
rw-r--r--
Editing: common.cpython-39.pyc
Close
a �'k`� � @ sh d dl mZ G dd� de�Zdd� Zdd� Zdd � Zd d� Zdd � Zdd� Z e dkrdd dlZe�� dS )� )�zipc s e Zd Zd� fdd� Z� ZS )�NotRelativePrimeErrorNc s4 t t| ��|pd|||f � || _|| _|| _d S )Nz.%d and %d are not relatively prime, divider=%i)�superr �__init__�a�b�d)�selfr r r �msg�� __class__� �)/opt/gsutil/third_party/rsa/rsa/common.pyr s �zNotRelativePrimeError.__init__)N)�__name__� __module__�__qualname__r � __classcell__r r r r r s r c C s2 z | � � W S ty, tdt| � ��Y n0 dS )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)�numr r r �bit_size s r c C s | dkrdS t t| �d�S )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. r � � )�ceil_divr )�numberr r r � byte_size; s r c C s t | |�\}}|r|d7 }|S )av 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. r )�divmod)r Zdiv�quanta�modr r r r T s r c C s� d}d}d}d}| }|}|dkr\| | }|| | } }||| | }}||| | }}q|dk rl||7 }|dk r|||7 }| ||fS )z@Returns a tuple (r, i, j) such that r = gcd(a, b) = ia + jb r r r ) r r �x�yZlxZlyZoa�ob�qr r r �extended_gcdl s r% c C s( t | |�\}}}|dkr$t| ||��|S )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 r )r% r )r! �nZdivider�inv�_r r r �inverse� s r) c C sX d}d}|D ]}||9 }qt || �D ].\}}|| }t||�}||| | | }q$|S )a� 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 r r )r r) ) Za_valuesZ modulo_values�mr! �moduloZm_iZa_iZM_ir'