Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ridwanmsharif/prsa
RSA Public Key Encryption
https://github.com/ridwanmsharif/prsa
cryptosystem decryption-key encryption-key public-key-cryptography rsa rsa-scheme
Last synced: about 2 months ago
JSON representation
RSA Public Key Encryption
- Host: GitHub
- URL: https://github.com/ridwanmsharif/prsa
- Owner: ridwanmsharif
- License: mit
- Created: 2016-11-24T04:06:32.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-02T16:49:53.000Z (almost 8 years ago)
- Last Synced: 2024-10-06T10:17:59.752Z (3 months ago)
- Topics: cryptosystem, decryption-key, encryption-key, public-key-cryptography, rsa, rsa-scheme
- Language: Python
- Size: 11.7 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RSA implementation (Python)
Implementation of the algorithms defined by the RSA scheme as a Command Line Utility.
Computes ciphertext from message and Computes message from ciphertext granted access to secret
decryption key by using Extended Euclidean Algorithm, Unicode Points,
Modular Arithmetic and [Modular Exponentiation](https://en.wikipedia.org/wiki/Modular_exponentiation)## Setup
```sh
pip install primesieve
pip install prsa
```## What is the RSA Scheme?
[RSA](https://en.wikipedia.org/wiki/RSA_(cryptosystem)) is one of the first practical public-key
cryptosystems and is widely used for secure data transmission. In this cryptosystem, the encryption key
is public and differs from the decryption key which is kept secret. In RSA, this asymmetry is based on
the practical difficulty of factoring the product of two large prime numbers, the factoring problem.
RSA is made of the initial letters of the surnames of Ron Rivest, Adi Shamir, and Leonard Adleman - The minds behind
the RSA Scheme.## Usage
**Help**
```sh
~$ prsa -h
usage: PRSA [-h] {decrypt,encrypt,generate} ...Implementation of the algorithms defined by the RSA scheme in Python3.
Computes ciphertext from message and Computes message from ciphertext granted
access to secret decryption key by using Extended Euclidean Algorithm, Unicode
Points, Modular Arithmetic and Modular Exponentiationpositional arguments:
{decrypt,encrypt,generate}
decrypt Decrypt ciphertext using RSA
encrypt Encrypt message using RSA
generate Find a key pair given the two natural numbersoptional arguments:
-h, --help show this help message and exit
```**Generate Help**
```sh
~$ prsa generate -h
usage: PRSA generate [-h] p qpositional arguments:
p An integer for setting a prime (p)
q An integer for setting a prime (q)optional arguments:
-h, --help show this help message and exit
```**Encrypt Help**
```
~$ prsa encrypt -h
usage: PRSA encrypt [-h] M e npositional arguments:
M Message to be encrypted
e A natural number that serves as the first element of the public
key
n A natural number that serves as the second element of the
private keyoptional arguments:
-h, --help show this help message and exit
```
**Decrypt Help**```
~$ prsa decrypt -h
usage: PRSA decrypt [-h] C d npositional arguments:
C Encoded ciphertext to be decrypted
d A natural number that serves as the first element of the private
key
n A natural number that serves as the second element of the
private keyoptional arguments:
-h, --help show this help message and exit
```## Example
**Generate Keys, Encrypt 'msg' and then Decrypt**
```sh
~$ prsa generate 31974198 84197413
{
'Public': [579312365, 1042765315429168511L],
'Private': [802880348865349973L, 1042765315429168511L],
}~$ prsa encrypt "msg" 579312365 1042765315429168511
585349761260265530~$ prsa decrypt 585349761260265530 802880348865349973 1042765315429168511
msg
```## Disclaimer
Purely experimental project. Designed for learning purposes not production use.
## Contributing
Bug reports and pull requests are welcome on GitHub at [@ridwanmsharif](https://www.github.com/ridwanmsharif)
## Author
Ridwan M. Sharif: [E-mail]([email protected]), [@ridwanmsharif](https://www.github.com/ridwanmsharif)
## License
The command line utility is available as open source under the terms of
the [MIT License](https://opensource.org/licenses/MIT)