Name | redacted-py JSON |
Version |
1.0.5
JSON |
| download |
home_page | None |
Summary | Redacting classified documents |
upload_time | 2024-09-11 14:43:54 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10.2 |
license | Copyright (c) 2024 Cyril Dever Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Subject to the terms and conditions of this license, each copyright holder and contributor hereby grants to those receiving rights under this license a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except for failure to satisfy the conditions of this license) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer this software, where such license applies only to those patent claims, already acquired or hereafter acquired, licensable by such copyright holder or contributor that are necessarily infringed by: (a) their Contribution(s) (the licensed copyrights of copyright holders and non-copyrightable additions of contributors, in source or binary form) alone; or (b) combination of their Contribution(s) with the work of authorship to which such Contribution(s) was added by such copyright holder or contributor, if, at the time the Contribution is added, such addition causes such combination to be necessarily infringed. The patent license shall not apply to any other combinations which include the Contribution. Except as expressly stated above, no rights or licenses from any copyright holder or contributor is granted under this license, whether expressly, by implication, estoppel or otherwise. DISCLAIMER THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
data
obfuscation
data masking
redacted
classified
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# redacted-py
_Redacting classified documents_
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/redacted)
![GitHub last commit](https://img.shields.io/github/last-commit/cyrildever/redacted)
![GitHub issues](https://img.shields.io/github/issues/cyrildever/redacted)
![GitHub license](https://img.shields.io/github/license/cyrildever/redacted)
![PyPI - Version](https://img.shields.io/pypi/v/redacted-py)
This repository holds the code base for my `redacted-py` library in Python. \
It is mainly based off my [Feistel cipher for Format-Preserving Encryption](https://github.com/cyrildever/feistel-py) to which I added a few tools to handle document, database and file manipulation to ease out the operation.
### Motivation
In some fields (like healthcare for instance), protecting the privacy of data whilst being able to conduct in-depth studies is both vital and mandatory. Redacting documents and databases is therefore the obligatory passage.
With `redacted-py`, I provide a simple yet secure tool to help redacting documents based on either a dictionary, a record layout or a tag to decide which parts should actually be redacted.
### Usage
You can use either a dictionary or a tag (or both) to identify the words you want to redact in a document.
The tag should be placed before any word that should be redacted. The default tag is the tilde character (`~`).
For example, the following sentence will only see the word `tagged` redacted: `"This is a ~tagged sentence"`.
```console
$ pip install redacted-py
```
```python
from redacted import DefaultRedactor, Dictionary
from feistel import FPECipher, SHA_256
source = "Some text ~tagged or using words in a dictionary"
cipher = FPECipher(SHA_256, key, 10)
redactor = DefaultRedactor(cipher)
redacted = redactor.redact(source)
expanded = redactor.expand(redacted)
assert expanded == source, "Original data should equal ciphered then deciphered data"
cleansed = redactor.clean(expanded)
assert cleansed == "Some text tagged or using words in a dictionary", "Cleaning should remove any tag mark"
```
You may also use it in the console with the following command line instructions:
```
usage: python3 -m redacted [-h] [-b | --both | --no-both] [-d DICTIONARY] [-H HASH] [-i INPUT] [-k KEY] [-o OUTPUT] [-r ROUNDS] [-t TAG] [-x | --expand | --no-expand]
options:
-h, --help show this help message and exit
-b, --both, --no-both
Add to use both dictionary and tag
-d DICTIONARY, --dictionary DICTIONARY
The optional path to the dictionary of words to redact
-H HASH, --hash HASH The hash engine for the round function [default sha-256]
-i INPUT, --input INPUT
The path to the document to be redacted
-k KEY, --key KEY The optional key for the FPE scheme (leave it empty to use default)
-o OUTPUT, --output OUTPUT
The name of the output file
-r ROUNDS, --rounds ROUNDS
The number of rounds for the Feistel cipher [default 10]
-t TAG, --tag TAG The optional tag that prefixes words to redact [default ~]
-x, --expand, --no-expand
Add to expand a redacted document
```
### Tests
```console
$ git clone https://github.com/cyrildever/redacted.git
$ cd redacted/py/
$ pip install -e .
$ python3 -m unittest discover
```
### License
The use of the `redacted` libraries and executables are subject to fees for commercial purpose and to the respect of the [BSD-2-Clause-Patent license](LICENSE). \
Please [contact me](mailto:cdever@pep-s.com) to get further information.
_NB: It is still under development so use in production at your own risk for now._
<hr />
© 2024 Cyril Dever. All rights reserved.
Raw data
{
"_id": null,
"home_page": null,
"name": "redacted-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10.2",
"maintainer_email": null,
"keywords": "data, obfuscation, data masking, redacted, classified",
"author": null,
"author_email": "Cyril Dever <cdever@pep-s.com>",
"download_url": "https://files.pythonhosted.org/packages/5b/86/fa08a91ce4555d2dda77e03a872c1d8fdab34ce5f94bb3a96146d123931b/redacted_py-1.0.5.tar.gz",
"platform": null,
"description": "# redacted-py\n_Redacting classified documents_\n\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/redacted)\n![GitHub last commit](https://img.shields.io/github/last-commit/cyrildever/redacted)\n![GitHub issues](https://img.shields.io/github/issues/cyrildever/redacted)\n![GitHub license](https://img.shields.io/github/license/cyrildever/redacted)\n![PyPI - Version](https://img.shields.io/pypi/v/redacted-py)\n\nThis repository holds the code base for my `redacted-py` library in Python. \\\nIt is mainly based off my [Feistel cipher for Format-Preserving Encryption](https://github.com/cyrildever/feistel-py) to which I added a few tools to handle document, database and file manipulation to ease out the operation.\n\n### Motivation\n\nIn some fields (like healthcare for instance), protecting the privacy of data whilst being able to conduct in-depth studies is both vital and mandatory. Redacting documents and databases is therefore the obligatory passage.\nWith `redacted-py`, I provide a simple yet secure tool to help redacting documents based on either a dictionary, a record layout or a tag to decide which parts should actually be redacted.\n\n\n### Usage\n\nYou can use either a dictionary or a tag (or both) to identify the words you want to redact in a document.\nThe tag should be placed before any word that should be redacted. The default tag is the tilde character (`~`).\n\nFor example, the following sentence will only see the word `tagged` redacted: `\"This is a ~tagged sentence\"`.\n\n```console\n$ pip install redacted-py\n```\n\n```python\nfrom redacted import DefaultRedactor, Dictionary\nfrom feistel import FPECipher, SHA_256\n\nsource = \"Some text ~tagged or using words in a dictionary\"\n\ncipher = FPECipher(SHA_256, key, 10)\nredactor = DefaultRedactor(cipher)\nredacted = redactor.redact(source)\n\nexpanded = redactor.expand(redacted)\nassert expanded == source, \"Original data should equal ciphered then deciphered data\"\n\ncleansed = redactor.clean(expanded)\nassert cleansed == \"Some text tagged or using words in a dictionary\", \"Cleaning should remove any tag mark\"\n```\n\nYou may also use it in the console with the following command line instructions:\n```\nusage: python3 -m redacted [-h] [-b | --both | --no-both] [-d DICTIONARY] [-H HASH] [-i INPUT] [-k KEY] [-o OUTPUT] [-r ROUNDS] [-t TAG] [-x | --expand | --no-expand]\n\noptions:\n -h, --help show this help message and exit\n -b, --both, --no-both\n Add to use both dictionary and tag\n -d DICTIONARY, --dictionary DICTIONARY\n The optional path to the dictionary of words to redact\n -H HASH, --hash HASH The hash engine for the round function [default sha-256]\n -i INPUT, --input INPUT\n The path to the document to be redacted\n -k KEY, --key KEY The optional key for the FPE scheme (leave it empty to use default)\n -o OUTPUT, --output OUTPUT\n The name of the output file\n -r ROUNDS, --rounds ROUNDS\n The number of rounds for the Feistel cipher [default 10]\n -t TAG, --tag TAG The optional tag that prefixes words to redact [default ~]\n -x, --expand, --no-expand\n Add to expand a redacted document\n```\n\n\n### Tests\n\n```console\n$ git clone https://github.com/cyrildever/redacted.git\n$ cd redacted/py/\n$ pip install -e .\n$ python3 -m unittest discover\n```\n\n\n### License\n\nThe use of the `redacted` libraries and executables are subject to fees for commercial purpose and to the respect of the [BSD-2-Clause-Patent license](LICENSE). \\\nPlease [contact me](mailto:cdever@pep-s.com) to get further information.\n\n_NB: It is still under development so use in production at your own risk for now._\n\n\n<hr />\n© 2024 Cyril Dever. All rights reserved.\n",
"bugtrack_url": null,
"license": "Copyright (c) 2024 Cyril Dever Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Subject to the terms and conditions of this license, each copyright holder and contributor hereby grants to those receiving rights under this license a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except for failure to satisfy the conditions of this license) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer this software, where such license applies only to those patent claims, already acquired or hereafter acquired, licensable by such copyright holder or contributor that are necessarily infringed by: (a) their Contribution(s) (the licensed copyrights of copyright holders and non-copyrightable additions of contributors, in source or binary form) alone; or (b) combination of their Contribution(s) with the work of authorship to which such Contribution(s) was added by such copyright holder or contributor, if, at the time the Contribution is added, such addition causes such combination to be necessarily infringed. The patent license shall not apply to any other combinations which include the Contribution. Except as expressly stated above, no rights or licenses from any copyright holder or contributor is granted under this license, whether expressly, by implication, estoppel or otherwise. DISCLAIMER THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Redacting classified documents",
"version": "1.0.5",
"project_urls": {
"Homepage": "https://github.com/cyrildever/redacted"
},
"split_keywords": [
"data",
" obfuscation",
" data masking",
" redacted",
" classified"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "890ea983e3bea4c2ade0ddaee6f015364382b86ad05fcff1e58ecf573ae77b8c",
"md5": "b8ce937e86ba9ce15d7f690d3065aaf0",
"sha256": "130404621517779d42c48b72c81d1607c99b91816d8a152016c5863dea03615a"
},
"downloads": -1,
"filename": "redacted_py-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b8ce937e86ba9ce15d7f690d3065aaf0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10.2",
"size": 9208,
"upload_time": "2024-09-11T14:43:52",
"upload_time_iso_8601": "2024-09-11T14:43:52.554048Z",
"url": "https://files.pythonhosted.org/packages/89/0e/a983e3bea4c2ade0ddaee6f015364382b86ad05fcff1e58ecf573ae77b8c/redacted_py-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5b86fa08a91ce4555d2dda77e03a872c1d8fdab34ce5f94bb3a96146d123931b",
"md5": "25a6761de0cf0d7e668d76ad42c5b26b",
"sha256": "5334cb6291df230dfb0153de05314e9bc078e0497948a40042b2cd5e1f28c82f"
},
"downloads": -1,
"filename": "redacted_py-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "25a6761de0cf0d7e668d76ad42c5b26b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10.2",
"size": 10481,
"upload_time": "2024-09-11T14:43:54",
"upload_time_iso_8601": "2024-09-11T14:43:54.040525Z",
"url": "https://files.pythonhosted.org/packages/5b/86/fa08a91ce4555d2dda77e03a872c1d8fdab34ce5f94bb3a96146d123931b/redacted_py-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-11 14:43:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cyrildever",
"github_project": "redacted",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "redacted-py"
}