prsa

Public Encryption Command Line Utility


Keywords
encryption, rsa, public, cryptography
License
Other
Install
pip install prsa==0.21

Documentation

RSA implementation (Python)

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 Exponentiation

Setup

pip install primesieve
pip install prsa

What is the RSA Scheme?

RSA 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

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 Exponentiation

positional arguments:
  {decrypt,encrypt,generate}
    decrypt             Decrypt ciphertext using RSA
    encrypt             Encrypt message using RSA
    generate            Find a key pair given the two natural numbers

optional arguments:
  -h, --help            show this help message and exit

prsa generate -h

usage: PRSA generate [-h] p q

positional 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

prsa encrypt -h

usage: PRSA encrypt [-h] M e n

positional 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 key

optional arguments:
  -h, --help  show this help message and exit

prsa decrypt -h

usage: PRSA decrypt [-h] C d n

positional 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 key

optional arguments:
  -h, --help  show this help message and exit

Example

~$ prsa generate 31974198 84197413
{
    'Public': [579312365, 1042765315429168511L], 
    'Private': [802880348865349973L, 1042765315429168511L],
}

~$ prsa encrypt "msg" 579312365 1042765315429168511
585349761260265530

~$ prsa decrypt 585349761260265530 802880348865349973 1042765315429168511
msg