tiny-rsa

RSA in pure Python


Keywords
rsa, python
License
MIT
Install
pip install tiny-rsa==0.0.1

Documentation

TinyRSA

RSA in pure Python.

Usage

import tiny_rsa

plain = 'Hello World!'

# e, n, p, q generated by python-rsa from http://stuvel.eu/rsa
e = '10001'
n = '483843201aaecd6a67ee700d017294e30372ce0c4f73c505ea1409367cc33d4517cb2b118da9a8242453a90e40db83b6cd011fbe19309781a5b0522dbd043959'

# d calculated using e, p, q by codes from http://en.wikipedia.org/wiki/Modular_multiplicative_inverse#Practical_Implementation_in_Python
d = '3edbc9811df85b8e6bdb9ae79704f616092059bb5944388e8748dd23f1beec180a44f1fdff67c08670b27e0253e1460c4651d685421e6007af37f1c4118a64a1'
result_encrypt = tiny_rsa.encrypt(plain, e, n)
got = tiny_rsa.decrypt(result_encrypt, d, n)
assert plain == got