secret-splitter


Namesecret-splitter JSON
Version 1.8.0 PyPI version JSON
download
home_page
SummarySplit secrets into pieces, or attemp to recover secrets by recombining a subset of pieces.
upload_time2023-03-28 21:44:24
maintainer
docs_urlNone
author
requires_python>=3.8
licenseBSD License Copyright (c) 2024, Henri Bourdeau. 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. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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 HOLDER 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 cryptography password secret sharing splitting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Secret Splitter

- Turn your digital secrets into digital puzzles (literally).
- Distribute the pieces among a group of people.
- Anyone can decode the secret by collecting all the pieces back.
- But if even one piece is missing, all they have is random data.
- You then trust that group of people to only share their pieces for a good reason.
- You can add resilience by allowing for some pieces to be missing / corrupt.


[Overview (wikipedia)](https://wikipedia.org/wiki/Secret_sharing)

This module implements:

- `block-wise SSS`: a block-wise version of [Shamir's secret sharing](https://wikipedia.org/wiki/Shamir%27s_secret_sharing).
    Full implementation details on [https://secret-splitter.com](https://secret-splitter.com).

    Working on blocks makes the algorithm linear in the number of bytes of the secret rather than exponential.

## Splitting

1. Apply a random mask to the secret
1. For each block of the mask, generate a polynomial of degree D-1
1. A piece consists of the masked secret and one point of each polynomial

## Recovery

1. Collect D pieces: D polynomials for each block of the mask
2. Interpolate the points to retrieve the blocks of the mask
3. Recover the secret by re-applying the mask to the masked version

## Standard piece format

A puzzle piece is a [yaml](https://yaml.org) serialisation of the following mapping:

```yaml
# string, tells if the secret encoded is a string encoded as UTF-8 ("utf-8") or a raw stream of bytes ("none")
encoding: utf-8

# one  puzzle piece, exact format depending on the implementation
# this implementation stores a sequence of [point, value] items, one per block of the secret
# Flow-sequence format preferred to keep it on one line
puzzle piece: [[1,258],[1,3]]

# base64 representation of the result of the mask XOR the byte representation of the secret
encoded secret: YXo=

# name of the algorithm used for splitting
algorithm: block-wise SSS

# different algorithms might add additional information required for recovering the secret.
```

## Installation

- Using PyPi

    `python3 -m pip install secret-splitter`

- From source

    `git clone https://git.sr.ht/~retzoh/secret-splitter-py && cd secret-splitter-py && python3 -m pip install .`

## Usage

- Command line

    `echo "secret" | python3 -m secret_splitter split 3 2 --stdin | python3 -m secret_splitter solve`

    See `python3 -m secret_splitter --help` for all options.

- Python script

    ```python
    >>> from secret_splitter import split, solve
    >>> pieces = split('secret', 3, 2)
    >>> secret = solve(pieces)
    ```

## Contibute

Contributions of new algorithms are welcome as long as they pass the test & lint suite.

To add a new algorithm, create src/secret_splitter/algorithm.py and add it to ALGORITHMS in
[src/secret_splitter/secret_splitter.py](https://git.sr.ht/~retzoh/secret-splitter-py/tree/master/item/src/secret_splitter/secret_splitter.py).

Install [redo](https://redo.readthedocs.io) and run `redo` from the root folder to run the tests.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "secret-splitter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "cryptography,password,secret,sharing,splitting",
    "author": "",
    "author_email": "Henri Bourdeau <hb@wolfzoh.com>",
    "download_url": "https://files.pythonhosted.org/packages/77/ad/4aa673e5d4b1ba778be6504f387be4675e0025ee1cd2d1d9724bdd3584b1/secret_splitter-1.8.0.tar.gz",
    "platform": null,
    "description": "# Secret Splitter\n\n- Turn your digital secrets into digital puzzles (literally).\n- Distribute the pieces among a group of people.\n- Anyone can decode the secret by collecting all the pieces back.\n- But if even one piece is missing, all they have is random data.\n- You then trust that group of people to only share their pieces for a good reason.\n- You can add resilience by allowing for some pieces to be missing / corrupt.\n\n\n[Overview (wikipedia)](https://wikipedia.org/wiki/Secret_sharing)\n\nThis module implements:\n\n- `block-wise SSS`: a block-wise version of [Shamir's secret sharing](https://wikipedia.org/wiki/Shamir%27s_secret_sharing).\n    Full implementation details on [https://secret-splitter.com](https://secret-splitter.com).\n\n    Working on blocks makes the algorithm linear in the number of bytes of the secret rather than exponential.\n\n## Splitting\n\n1. Apply a random mask to the secret\n1. For each block of the mask, generate a polynomial of degree D-1\n1. A piece consists of the masked secret and one point of each polynomial\n\n## Recovery\n\n1. Collect D pieces: D polynomials for each block of the mask\n2. Interpolate the points to retrieve the blocks of the mask\n3. Recover the secret by re-applying the mask to the masked version\n\n## Standard piece format\n\nA puzzle piece is a [yaml](https://yaml.org) serialisation of the following mapping:\n\n```yaml\n# string, tells if the secret encoded is a string encoded as UTF-8 (\"utf-8\") or a raw stream of bytes (\"none\")\nencoding: utf-8\n\n# one  puzzle piece, exact format depending on the implementation\n# this implementation stores a sequence of [point, value] items, one per block of the secret\n# Flow-sequence format preferred to keep it on one line\npuzzle piece: [[1,258],[1,3]]\n\n# base64 representation of the result of the mask XOR the byte representation of the secret\nencoded secret: YXo=\n\n# name of the algorithm used for splitting\nalgorithm: block-wise SSS\n\n# different algorithms might add additional information required for recovering the secret.\n```\n\n## Installation\n\n- Using PyPi\n\n    `python3 -m pip install secret-splitter`\n\n- From source\n\n    `git clone https://git.sr.ht/~retzoh/secret-splitter-py && cd secret-splitter-py && python3 -m pip install .`\n\n## Usage\n\n- Command line\n\n    `echo \"secret\" | python3 -m secret_splitter split 3 2 --stdin | python3 -m secret_splitter solve`\n\n    See `python3 -m secret_splitter --help` for all options.\n\n- Python script\n\n    ```python\n    >>> from secret_splitter import split, solve\n    >>> pieces = split('secret', 3, 2)\n    >>> secret = solve(pieces)\n    ```\n\n## Contibute\n\nContributions of new algorithms are welcome as long as they pass the test & lint suite.\n\nTo add a new algorithm, create src/secret_splitter/algorithm.py and add it to ALGORITHMS in\n[src/secret_splitter/secret_splitter.py](https://git.sr.ht/~retzoh/secret-splitter-py/tree/master/item/src/secret_splitter/secret_splitter.py).\n\nInstall [redo](https://redo.readthedocs.io) and run `redo` from the root folder to run the tests.\n",
    "bugtrack_url": null,
    "license": "BSD License  Copyright (c) 2024, Henri Bourdeau.  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. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  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 HOLDER 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": "Split secrets into pieces, or attemp to recover secrets by recombining a subset of pieces.",
    "version": "1.8.0",
    "split_keywords": [
        "cryptography",
        "password",
        "secret",
        "sharing",
        "splitting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d24ba422367051caf375e78b2272b1438cd7ea379b3ce49250c2dc53483ad4f3",
                "md5": "4dd392710aa797129cab9ad2ff796494",
                "sha256": "7f224d362d07f5ea0257a7b61e55df8f0eab9b146639f482fdf201d3832d7ee0"
            },
            "downloads": -1,
            "filename": "secret_splitter-1.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4dd392710aa797129cab9ad2ff796494",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12575,
            "upload_time": "2023-03-28T21:44:23",
            "upload_time_iso_8601": "2023-03-28T21:44:23.070193Z",
            "url": "https://files.pythonhosted.org/packages/d2/4b/a422367051caf375e78b2272b1438cd7ea379b3ce49250c2dc53483ad4f3/secret_splitter-1.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77ad4aa673e5d4b1ba778be6504f387be4675e0025ee1cd2d1d9724bdd3584b1",
                "md5": "1ca77791c000de909b171c3bd0ee1eee",
                "sha256": "ed341fcd1c7794db7bde2f3ea2461079ea9ea8ac92b16f2c39110b761626c319"
            },
            "downloads": -1,
            "filename": "secret_splitter-1.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ca77791c000de909b171c3bd0ee1eee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 19859,
            "upload_time": "2023-03-28T21:44:24",
            "upload_time_iso_8601": "2023-03-28T21:44:24.319692Z",
            "url": "https://files.pythonhosted.org/packages/77/ad/4aa673e5d4b1ba778be6504f387be4675e0025ee1cd2d1d9724bdd3584b1/secret_splitter-1.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-28 21:44:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "secret-splitter"
}
        
Elapsed time: 0.06565s