Support signing a pre-calculated hash (#87)

* Split the hashing out of the sign method

This code change adds support to split the hashing of a message
and the actual signing of the message.

* Updating unit test and documentation

This commit updates the unit test and usage docs. In addition,
This change removes a redundant error check inside rsa.sign().

* Refactore unit tests and code comments

Removed the print statements from the unit test and refactored a
few code comments to improve readability.

* Rename hash function

The new hash function had the same name as a function in the
standard library. This commit changes the name to avoid conflicts.

* Rename hash function to compute_hash()

This commit renames the hash function to compute_hash().
4 files changed
tree: 824a0e34f6bc4e88bbbb6bfa7e2f7a80d5399aa3
  1. doc/
  2. rsa/
  3. tests/
  4. .codeclimate.yml
  5. .coveragerc
  6. .gitignore
  7. .travis.yml
  8. CHANGELOG.txt
  9. create_timing_table.py
  10. LICENSE
  11. MANIFEST.in
  12. README.md
  13. requirements.txt
  14. setup.cfg
  15. setup.py
  16. speed.sh
  17. tox.ini
README.md

Pure Python RSA implementation

PyPI [Build Status] (https://travis-ci.org/sybrenstuvel/python-rsa) [Coverage Status] (https://coveralls.io/github/sybrenstuvel/python-rsa?branch=master) [Code Climate] (https://codeclimate.com/github/sybrenstuvel/python-rsa)

Python-RSA is a pure-Python RSA implementation. It supports encryption and decryption, signing and verifying signatures, and key generation according to PKCS#1 version 1.5. It can be used as a Python library as well as on the commandline. The code was mostly written by Sybren A. Stüvel.

Documentation can be found at the Python-RSA homepage.

Download and install using:

pip install rsa

or download it from the Python Package Index.

The source code is maintained at Github and is licensed under the Apache License, version 2.0

Plans for the future

Version 3.4 is the last version in the 3.x range. Version 4.0 will drop the following modules, as they are insecure:

  • rsa._version133
  • rsa._version200
  • rsa.bigfile
  • rsa.varblock

Those modules are marked as deprecated in version 3.4.

Furthermore, in 4.0 the I/O functions will be streamlined to always work with bytes on all supported versions of Python.

Version 4.0 will drop support for Python 2.6, and possibly for Python 3.3.