File: //opt/cppython/lib/python3.8/site-packages/rsa/__pycache__/core.cpython-38.pyc
U
JD�g� � @ sB d Z eedd�dd�Zeeeed�dd�Zeeeed�d d
�ZdS )z}Core mathematical operations.
This is the actual core RSA implementation, which is only defined
mathematically on integers.
N)�var�name�returnc C s$ t | t�rd S td|| jf ��d S )Nz%s should be an integer, not %s)�
isinstance�int� TypeError� __class__)r r � r �5/opt/cppython/lib/python3.8/site-packages/rsa/core.py�
assert_int s
r
)�message�ekey�nr c C sR t | d� t |d� t |d� | dk r.td��| |krFtd| |f ��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
r r r �encrypt_int s
r )�
cyphertext�dkeyr
r c C s. 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 r r r �decrypt_int- s
r )�__doc__r �strr
r r r r r r �<module> s