{"id":21453443,"url":"https://github.com/lapets/shamirs","last_synced_at":"2025-07-14T23:31:36.931Z","repository":{"id":42776677,"uuid":"116900921","full_name":"lapets/shamirs","owner":"lapets","description":"Minimal pure-Python implementation of Shamir's secret sharing scheme.","archived":false,"fork":false,"pushed_at":"2025-01-02T00:17:14.000Z","size":91,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T01:44:32.267Z","etag":null,"topics":["cryptography","library","mpc","multi-party-computation","multiparty-computation","python","python-library","secret-sharing","secure-mpc","secure-multiparty-computation","shamir-secret-sharing","shamirs-secret-sharing"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/shamirs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lapets.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-10T03:08:25.000Z","updated_at":"2025-02-25T02:40:50.000Z","dependencies_parsed_at":"2024-11-23T06:45:11.400Z","dependency_job_id":null,"html_url":"https://github.com/lapets/shamirs","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":"0.13793103448275867","last_synced_commit":"089d816b72ab236c634f16e4d86aa7af4af3c9be"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/lapets/shamirs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fshamirs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fshamirs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fshamirs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fshamirs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lapets","download_url":"https://codeload.github.com/lapets/shamirs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapets%2Fshamirs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264965512,"owners_count":23690228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","library","mpc","multi-party-computation","multiparty-computation","python","python-library","secret-sharing","secure-mpc","secure-multiparty-computation","shamir-secret-sharing","shamirs-secret-sharing"],"created_at":"2024-11-23T04:39:39.531Z","updated_at":"2025-07-14T23:31:36.924Z","avatar_url":"https://github.com/lapets.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=======\nshamirs\n=======\n\nMinimal pure-Python implementation of `Shamir's secret sharing scheme \u003chttps://en.wikipedia.org/wiki/Shamir%27s_secret_sharing\u003e`__.\n\n|pypi| |readthedocs| |actions| |coveralls|\n\n.. |pypi| image:: https://badge.fury.io/py/shamirs.svg#\n   :target: https://badge.fury.io/py/shamirs\n   :alt: PyPI version and link.\n\n.. |readthedocs| image:: https://readthedocs.org/projects/shamirs/badge/?version=latest\n   :target: https://shamirs.readthedocs.io/en/latest/?badge=latest\n   :alt: Read the Docs documentation status.\n\n.. |actions| image:: https://github.com/lapets/shamirs/workflows/lint-test-cover-docs/badge.svg#\n   :target: https://github.com/lapets/shamirs/actions/workflows/lint-test-cover-docs.yml\n   :alt: GitHub Actions status.\n\n.. |coveralls| image:: https://coveralls.io/repos/github/lapets/shamirs/badge.svg?branch=main\n   :target: https://coveralls.io/github/lapets/shamirs?branch=main\n   :alt: Coveralls test coverage summary.\n\nPurpose\n-------\n\n.. |secrets_token_bytes| replace:: ``secrets.token_bytes``\n.. _secrets_token_bytes: https://docs.python.org/3/library/secrets.html#secrets.token_bytes\n\nThis library provides functions and data structures for computing secret shares given an integer input value and for reassembling an integer from its corresponding secret shares via Lagrange interpolation over finite fields (according to `Shamir's secret sharing scheme \u003chttps://en.wikipedia.org/wiki/Shamir%27s_secret_sharing\u003e`__). The built-in |secrets_token_bytes|_ function and rejection sampling are used to generate random coefficients. The `lagrange \u003chttps://pypi.org/project/lagrange\u003e`__ library is used for Lagrange interpolation.\n\nInstallation and Usage\n----------------------\nThis library is available as a `package on PyPI \u003chttps://pypi.org/project/shamirs\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install shamirs\n\nThe library can be imported in the usual way:\n\n.. code-block:: python\n\n    import shamirs\n\nExamples\n^^^^^^^^\nThe library provides functions for transforming a nonnegative integer value into a number of secret shares and for reassembling those shares back into the value they represent:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e ss = shamirs.shares(123, quantity=3)\n    \u003e\u003e\u003e len(ss)\n    3\n    \u003e\u003e\u003e shamirs.interpolate(ss)\n    123\n    \u003e\u003e\u003e ss = shamirs.shares(456, quantity=20, modulus=15485867, threshold=10)\n    \u003e\u003e\u003e shamirs.interpolate(ss[5:15], threshold=10)\n    456\n\nAddition of shares and multiplication of shares by a scalar are both supported:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e (r, s, t) = shamirs.shares(123, 3)\n    \u003e\u003e\u003e (u, v, w) = shamirs.shares(456, 3)\n    \u003e\u003e\u003e shamirs.interpolate([r + u, s + v, t + w])\n    579\n    \u003e\u003e\u003e (r, s, t) = shamirs.shares(123, 3)\n    \u003e\u003e\u003e r = r * 2\n    \u003e\u003e\u003e s = s * 2\n    \u003e\u003e\u003e t = t * 2\n    \u003e\u003e\u003e shamirs.interpolate([r, s, t])\n    246\n\nDevelopment\n-----------\nAll installation and development dependencies are fully specified in ``pyproject.toml``. The ``project.optional-dependencies`` object is used to `specify optional requirements \u003chttps://peps.python.org/pep-0621\u003e`__ for various development tasks. This makes it possible to specify additional options (such as ``docs``, ``lint``, and so on) when performing installation using `pip \u003chttps://pypi.org/project/pip\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install \".[docs,lint]\"\n\nDocumentation\n^^^^^^^^^^^^^\nThe documentation can be generated automatically from the source files using `Sphinx \u003chttps://www.sphinx-doc.org\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install \".[docs]\"\n    cd docs\n    sphinx-apidoc -f -E --templatedir=_templates -o _source .. \u0026\u0026 make html\n\nTesting and Conventions\n^^^^^^^^^^^^^^^^^^^^^^^\nAll unit tests are executed and their coverage is measured when using `pytest \u003chttps://docs.pytest.org\u003e`__ (see the ``pyproject.toml`` file for configuration details):\n\n.. code-block:: bash\n\n    python -m pip install \".[test]\"\n    python -m pytest -W ignore::UserWarning\n\nAlternatively, all unit tests are included in the module itself and can be executed using `doctest \u003chttps://docs.python.org/3/library/doctest.html\u003e`__:\n\n.. code-block:: bash\n\n    python src/shamirs/shamirs.py -v\n\nStyle conventions are enforced using `Pylint \u003chttps://pylint.readthedocs.io\u003e`__:\n\n.. code-block:: bash\n\n    python -m pip install \".[lint]\"\n    python -m pylint src/shamirs\n\nContributions\n^^^^^^^^^^^^^\nIn order to contribute to the source code, open an issue or submit a pull request on the `GitHub page \u003chttps://github.com/lapets/shamirs\u003e`__ for this library.\n\nVersioning\n^^^^^^^^^^\nBeginning with version 1.0.0, the version number format for this library and the changes to the library associated with version number increments conform with `Semantic Versioning 2.0.0 \u003chttps://semver.org/#semantic-versioning-200\u003e`__.\n\nPublishing\n^^^^^^^^^^\nThis library can be published as a `package on PyPI \u003chttps://pypi.org/project/shamirs\u003e`__ via the GitHub Actions workflow found in ``.github/workflows/build-publish-sign-release.yml`` that follows the `recommendations found in the Python Packaging User Guide \u003chttps://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/\u003e`__.\n\nEnsure that the correct version number appears in ``pyproject.toml``, and that any links in this README document to the Read the Docs documentation of this package (or its dependencies) have appropriate version numbers. Also ensure that the Read the Docs project for this library has an `automation rule \u003chttps://docs.readthedocs.io/en/stable/automation-rules.html\u003e`__ that activates and sets as the default all tagged versions.\n\nTo publish the package, create and push a tag for the version being published (replacing ``?.?.?`` with the version number):\n\n.. code-block:: bash\n\n    git tag ?.?.?\n    git push origin ?.?.?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapets%2Fshamirs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flapets%2Fshamirs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapets%2Fshamirs/lists"}