https://github.com/jpvitan/marsa
A Python library that lets you experiment with the mathematics of the Rivest–Shamir–Adleman (RSA) cryptosystem.
https://github.com/jpvitan/marsa
cryptography number-theory pypi python rsa
Last synced: 3 months ago
JSON representation
A Python library that lets you experiment with the mathematics of the Rivest–Shamir–Adleman (RSA) cryptosystem.
- Host: GitHub
- URL: https://github.com/jpvitan/marsa
- Owner: jpvitan
- License: mit
- Created: 2020-12-27T09:55:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-16T18:33:37.000Z (almost 2 years ago)
- Last Synced: 2026-03-27T03:25:18.378Z (3 months ago)
- Topics: cryptography, number-theory, pypi, python, rsa
- Language: Python
- Homepage: https://pypi.org/project/marsa/
- Size: 584 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**MARSA** is a Python library that lets you experiment with the mathematics of the Rivest–Shamir–Adleman (RSA) cryptosystem.


## 📋 Quick Guide
### Installation
You can install **MARSA** using pip. Simply run the following command in your terminal or command prompt:
```
pip install marsa
```
### Key Generation
To generate a key pair, import the `rsa` module from the `marsa` package and create an instance of the `KeyPair` class:
```python
from marsa import rsa
key_pair = rsa.KeyPair()
```
### Encryption
To encrypt, create an instance of the `Encryptor` class with the public key from your `KeyPair` object and use the `encrypt()` method:
```python
encryptor = rsa.Encryptor(key_pair.public_key)
secret_message = encryptor.encrypt(message)
```
If you don't have access to the `KeyPair` object, you can manually create a key by using the `Key` class:
```python
public_key = rsa.Key(product, exponent)
```
### Decryption
Decryption works similar to encryption. If you need to decrypt, create an instance of the `Decryptor` class with the private key from your `KeyPair` object and use the `decrypt()` method:
```python
decryptor = rsa.Decryptor(key_pair.private_key)
message = decryptor.decrypt(secret_message)
```
## 🛠️ Software
### Developer
Built by [Justine Paul Vitan](https://jpvitan.com) as a solo project to demonstrate his knowledge in cryptography and number theory. The source code of this project is open and available to the public via GitHub for transparency and open-source collaboration.
### License
This project is under the [MIT license](https://github.com/jpvitan/marsa/blob/master/LICENSE). Please read the terms and conditions stated within the license before attempting any modification or distribution of the software.
## ⚠️️ Warning
### Production Use
**MARSA** is intended solely for educational purposes to illustrate the fundamental concepts of RSA encryption and decryption. It is not suitable for use in production environments where security is paramount. Please be aware that this implementation lacks essential security features, such as proper padding schemes, and should not be relied upon for real-world applications. For secure RSA implementations suitable for production use, consider utilizing established cryptographic libraries and frameworks.