
    &g                     N    d Z dededdfdZdedededefd	Zd
edededefdZdS )z}Core mathematical operations.

This is the actual core RSA implementation, which is only defined
mathematically on integers.
varnamereturnNc                 b    t          | t                    rd S t          |d| j                  )Nz should be an integer, not )
isinstanceint	TypeError	__class__)r   r   s     :/var/www/api/venv/lib/python3.11/site-packages/rsa/core.py
assert_intr      s4    #s 
s}}M
N
NN    messageekeync                     t          | d           t          |d           t          |d           | dk     rt          d          | |k    rt          d| |fz            t          | ||          S )z@Encrypts a message using encryption key 'ekey', working modulo nr   r   r       z'Only non-negative numbers are supportedz#The message %i is too long for n=%i)r   
ValueErrorOverflowErrorpow)r   r   r   s      r
   encrypt_intr      s     w	"""tVq#{{BCCC{{AWaLPQQQwa   r   
cyphertextdkeyc                     t          | d           t          |d           t          |d           t          | ||          }|S )zHDecrypts a cypher text using the decryption key 'dkey', working modulo nr   r   r   )r   r   )r   r   r   r   s       r
   decrypt_intr   -   sJ     z<(((tVq#*dA&&GNr   )__doc__r   strr   r   r    r   r
   <module>r      s    OC Os Ot O O O O! !C !C !C ! ! ! ! C s s s      r   