https://github.com/rncryptor/rncryptor-python
Python implementation of RNCryptor
https://github.com/rncryptor/rncryptor-python
aes python rncryptor
Last synced: about 1 year ago
JSON representation
Python implementation of RNCryptor
- Host: GitHub
- URL: https://github.com/rncryptor/rncryptor-python
- Owner: RNCryptor
- License: mit
- Created: 2014-01-12T22:04:55.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-11-30T20:57:51.000Z (over 1 year ago)
- Last Synced: 2025-03-28T07:09:17.278Z (about 1 year ago)
- Topics: aes, python, rncryptor
- Language: Python
- Size: 35.2 KB
- Stars: 51
- Watchers: 7
- Forks: 23
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
RNCryptor-python
================
.. image:: https://img.shields.io/pypi/v/rncryptor.svg
:alt: Actual PyPI version
:target: https://pypi.python.org/pypi/rncryptor/
.. image:: https://travis-ci.org/RNCryptor/RNCryptor-python.svg?branch=master
:target: https://travis-ci.org/RNCryptor/RNCryptor-python
:alt: CI status
Python implementation of `RNCryptor `_
Installation
------------
.. code-block:: bash
$ pip install rncryptor
Usage
-----
.. code-block:: python
import rncryptor
data = '...'
password = '...'
# rncryptor.RNCryptor's methods
cryptor = rncryptor.RNCryptor()
encrypted_data = cryptor.encrypt(data, password)
decrypted_data = cryptor.decrypt(encrypted_data, password)
assert data == decrypted_data
# rncryptor's functions
encrypted_data = rncryptor.encrypt(data, password)
decrypted_data = rncryptor.decrypt(encrypted_data, password)
assert data == decrypted_data
# encrypt_with_keys and decrypt_with keys functions
encryption_salt = '...' # 8 random bytes
encryption_key = rncryptor.make_key(password, encryption_salt)
hmac_key = rncryptor.make_key(password, hmac_salt)
encrypted_data = rncryptor.encrypt_with_keys(data, hmac_key, encryption_key)
decrypted_data = rncryptor.decrypt_with_keys(encrypted_data, hmac_key, encryption_key)
Testing
-------
.. code-block:: bash
$ tox
$ tox -e py27 # test using only Python2.7
$ tox $(nproc) # run tests using all processes
An actual command can be found in `tox.ini `_, but basically it's a common ``py.test`` with a bunch of plugins.