This is a Python RSA asymmetric cryptography algorithm uploaded on an autonomous instance of the package index (TestPyPI) deliberated for probation.
Execute the venv
module as a script to initiate a virtual environment:
$ python -m venv venv
Activate it:
$ source venv/Scripts/activate
Install the package:
(venv)
$ pip install -i https://test.pypi.org/simple/ rsa-pasaforte
And invoke the Python Interactive Interpreter:
(venv)
$ python
import
it:
>>> from rsa_pasaforte import utility, main
Employ the generate_keys()
function within the utility
module and tuple-unpack or destructure it.
Its return value type hint is:
Tuple[Tuple[int, int], Tuple[int, int]]
>>> public_key, private_key = utility.generate_keys()
The encryption
key is public and distinct from the decryption
key (held undisclosed).
public_key: Tuple[int, int]
private_key: Tuple[int, int]
Initialize the plaintext
variable with a string literal of your preference.
>>> plaintext = 'Python'
Toss the plaintext
and public_key
as arguments of the main
module’s encrypt()
subroutine.
ciphertext: Iterable[int]
>>> ciphertext = main.encrypt(plaintext, public_key)
>>> print(*ciphertext)
3606640 4172688 6583515 3193439 436542 872288
To crack the ciphertext
, hand it over with the private_key
as arguments of the decrypt()
subroutine.
>>> plaintext = main.decrypt(ciphertext, private_key)
>>> print(plaintext)
Python