pprp


Namepprp JSON
Version 0.2.7 PyPI version JSON
download
home_pagehttps://github.com/dsoprea/RijndaelPbkdf
SummaryA pure-Python Rijndael (AES) and PBKDF2 library. Python 2.7 and Python3 compatible.
upload_time2020-07-11 19:44:24
maintainer
docs_urlNone
authorDustin Oprea
requires_python
licenseGPL 2
keywords rijdael pbkdf2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.org/dsoprea/RijndaelPbkdf.svg?branch=master)](https://travis-ci.org/dsoprea/RijndaelPbkdf)

## Overview

This package was a remedy to there being no PyPI-published, pure-Python 
Rijndael (AES) implementations, and that nothing available, in general, was 
compatible with both Python2 *and* Python3. The same is true of the PBKDF2 
key-expansion algorithm.

The encryptor takes a source generator (which yields individual blocks). There 
are source-generators provided for both data from a variable and data from a 
file. It is trivial if you'd like to write your own. The encryptor and 
decryptor functions are written as generators. Decrypted data has PKCS7
padding. A utility function is provided to trim this (*trim_pkcs7_padding*).

The implementation includes Python2 and Python3 implementations of both 
Rijndael and PBKDF2, and chooses the version when loaded.

The default block-size is 128-bits in order to be compatible with AES.

This project is also referred to as *pprp*, which stands for "Pure Python 
Rijndael and PBKDF2".


## Installation

Install via *pip*:

```
$ sudo pip install pprp
```


## Example

Encrypt and decrypt the data, and compare the results. This was copied directly
from the unit-test.

```python
passphrase = 'password'.encode('ASCII')
salt = 'salt'.encode('ASCII')

key_size = 32
data = "this is a test" * 100
data_bytes = data.encode('ASCII')

key = pprp.pbkdf2(passphrase, salt, key_size)

# Create a source from available data.
sg = pprp.data_source_gen(data_bytes)

# Feed the source into the encryptor.
eg = pprp.rijndael_encrypt_gen(key, sg)

# Feed the encryptor into the decryptor.
dg = pprp.rijndael_decrypt_gen(key, eg)

# Sink the output into an IO-stream.
decrypted = pprp.decrypt_sink(dg)

# self.assertEquals(data_bytes, decrypted)
```


## Notes

The generators can take a block-size in the event that you don't want the 
default. The default block-size can also be changed via the PPRP_BLOCK_SIZE 
environment variable.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dsoprea/RijndaelPbkdf",
    "name": "pprp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "rijdael pbkdf2",
    "author": "Dustin Oprea",
    "author_email": "myselfasunder@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7d/8a/6bcc32e0f6cf0a9e0132230cb41652bd3df3dbdb0e673e31b720b6111deb/pprp-0.2.7.tar.gz",
    "platform": "",
    "description": "[![Build Status](https://travis-ci.org/dsoprea/RijndaelPbkdf.svg?branch=master)](https://travis-ci.org/dsoprea/RijndaelPbkdf)\n\n## Overview\n\nThis package was a remedy to there being no PyPI-published, pure-Python \nRijndael (AES) implementations, and that nothing available, in general, was \ncompatible with both Python2 *and* Python3. The same is true of the PBKDF2 \nkey-expansion algorithm.\n\nThe encryptor takes a source generator (which yields individual blocks). There \nare source-generators provided for both data from a variable and data from a \nfile. It is trivial if you'd like to write your own. The encryptor and \ndecryptor functions are written as generators. Decrypted data has PKCS7\npadding. A utility function is provided to trim this (*trim_pkcs7_padding*).\n\nThe implementation includes Python2 and Python3 implementations of both \nRijndael and PBKDF2, and chooses the version when loaded.\n\nThe default block-size is 128-bits in order to be compatible with AES.\n\nThis project is also referred to as *pprp*, which stands for \"Pure Python \nRijndael and PBKDF2\".\n\n\n## Installation\n\nInstall via *pip*:\n\n```\n$ sudo pip install pprp\n```\n\n\n## Example\n\nEncrypt and decrypt the data, and compare the results. This was copied directly\nfrom the unit-test.\n\n```python\npassphrase = 'password'.encode('ASCII')\nsalt = 'salt'.encode('ASCII')\n\nkey_size = 32\ndata = \"this is a test\" * 100\ndata_bytes = data.encode('ASCII')\n\nkey = pprp.pbkdf2(passphrase, salt, key_size)\n\n# Create a source from available data.\nsg = pprp.data_source_gen(data_bytes)\n\n# Feed the source into the encryptor.\neg = pprp.rijndael_encrypt_gen(key, sg)\n\n# Feed the encryptor into the decryptor.\ndg = pprp.rijndael_decrypt_gen(key, eg)\n\n# Sink the output into an IO-stream.\ndecrypted = pprp.decrypt_sink(dg)\n\n# self.assertEquals(data_bytes, decrypted)\n```\n\n\n## Notes\n\nThe generators can take a block-size in the event that you don't want the \ndefault. The default block-size can also be changed via the PPRP_BLOCK_SIZE \nenvironment variable.",
    "bugtrack_url": null,
    "license": "GPL 2",
    "summary": "A pure-Python Rijndael (AES) and PBKDF2 library. Python 2.7 and Python3 compatible.",
    "version": "0.2.7",
    "split_keywords": [
        "rijdael",
        "pbkdf2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "bdece6122ca59a74d2cc39ad31ca5c13",
                "sha256": "d9e76779cc52b0938dbc7f5727a195dc4c6075c3eb504025611a59b7636b930d"
            },
            "downloads": -1,
            "filename": "pprp-0.2.7.tar.gz",
            "has_sig": false,
            "md5_digest": "bdece6122ca59a74d2cc39ad31ca5c13",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8506,
            "upload_time": "2020-07-11T19:44:24",
            "upload_time_iso_8601": "2020-07-11T19:44:24.924490Z",
            "url": "https://files.pythonhosted.org/packages/7d/8a/6bcc32e0f6cf0a9e0132230cb41652bd3df3dbdb0e673e31b720b6111deb/pprp-0.2.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-07-11 19:44:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "dsoprea",
    "error": "Could not fetch GitHub repository",
    "lcname": "pprp"
}
        
Elapsed time: 0.09685s