ntc-pcrypto


Namentc-pcrypto JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/congnghia0609/ntc-pcrypto
Summaryntc-pcrypto is a module python cryptography
upload_time2024-10-26 19:33:31
maintainerNone
docs_urlNone
authorNghiaTC
requires_pythonNone
licenseApache License 2.0
keywords ntc-pcrypto pcrypto cryptography crypto encrypt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ntc-pcrypto
ntc-pcrypto is a module python cryptography

## Installation
From pip:  
```bash
pip install ntc-pcrypto
```
From Source:  
```bash
git clone https://github.com/congnghia0609/ntc-pcrypto.git
cd ntc-pcrypto
python3 setup.py install
```

## Check version
```bash
pip show ntc-pcrypto
```

## 1. An implementation of Shamir's Secret Sharing Algorithm 256-bits in Python

### Usage
**Use encode/decode Base64URL**  
```python
from sss.sss import *

s = "nghiatcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
print("secret:", s)
print("secret.length:", len(s))
# creates a set of shares
arr = create(3, 6, s, True)
# combines shares into secret
s1 = combine(arr[:3], True)
print("combines shares 1 length =", len(arr[:3]))
print("secret:", s1)
print("secret.length:", len(s1))

s2 = combine(arr[3:], True)
print("combines shares 2 length =", len(arr[3:]))
print("secret:", s2)
print("secret.length:", len(s2))

s3 = combine(arr[1:5], True)
print("combines shares 3 length =", len(arr[1:5]))
print("secret:", s3)
print("secret.length:", len(s3))
```

**Use encode/decode Hex**  
```python
from sss.sss import *

s = "nghiatcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
print("secret:", s)
print("secret.length:", len(s))
# creates a set of shares
arr = create(3, 6, s, False)
# combines shares into secret
s1 = combine(arr[:3], False)
print("combines shares 1 length =", len(arr[:3]))
print("secret:", s1)
print("secret.length:", len(s1))

s2 = combine(arr[3:], False)
print("combines shares 2 length =", len(arr[3:]))
print("secret:", s2)
print("secret.length:", len(s2))

s3 = combine(arr[1:5], False)
print("combines shares 3 length =", len(arr[1:5]))
print("secret:", s3)
print("secret.length:", len(s3))
```

## License
This code is under the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/congnghia0609/ntc-pcrypto",
    "name": "ntc-pcrypto",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "ntc-pcrypto, pcrypto, cryptography, crypto, encrypt",
    "author": "NghiaTC",
    "author_email": "congnghia0609@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dd/c4/b8bba038a9088812eca910d68aca8677b9ef2812c59953902c1c9fdd60f4/ntc-pcrypto-0.2.0.tar.gz",
    "platform": null,
    "description": "# ntc-pcrypto\nntc-pcrypto is a module python cryptography\n\n## Installation\nFrom pip:  \n```bash\npip install ntc-pcrypto\n```\nFrom Source:  \n```bash\ngit clone https://github.com/congnghia0609/ntc-pcrypto.git\ncd ntc-pcrypto\npython3 setup.py install\n```\n\n## Check version\n```bash\npip show ntc-pcrypto\n```\n\n## 1. An implementation of Shamir's Secret Sharing Algorithm 256-bits in Python\n\n### Usage\n**Use encode/decode Base64URL**  \n```python\nfrom sss.sss import *\n\ns = \"nghiatcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\nprint(\"secret:\", s)\nprint(\"secret.length:\", len(s))\n# creates a set of shares\narr = create(3, 6, s, True)\n# combines shares into secret\ns1 = combine(arr[:3], True)\nprint(\"combines shares 1 length =\", len(arr[:3]))\nprint(\"secret:\", s1)\nprint(\"secret.length:\", len(s1))\n\ns2 = combine(arr[3:], True)\nprint(\"combines shares 2 length =\", len(arr[3:]))\nprint(\"secret:\", s2)\nprint(\"secret.length:\", len(s2))\n\ns3 = combine(arr[1:5], True)\nprint(\"combines shares 3 length =\", len(arr[1:5]))\nprint(\"secret:\", s3)\nprint(\"secret.length:\", len(s3))\n```\n\n**Use encode/decode Hex**  \n```python\nfrom sss.sss import *\n\ns = \"nghiatcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\nprint(\"secret:\", s)\nprint(\"secret.length:\", len(s))\n# creates a set of shares\narr = create(3, 6, s, False)\n# combines shares into secret\ns1 = combine(arr[:3], False)\nprint(\"combines shares 1 length =\", len(arr[:3]))\nprint(\"secret:\", s1)\nprint(\"secret.length:\", len(s1))\n\ns2 = combine(arr[3:], False)\nprint(\"combines shares 2 length =\", len(arr[3:]))\nprint(\"secret:\", s2)\nprint(\"secret.length:\", len(s2))\n\ns3 = combine(arr[1:5], False)\nprint(\"combines shares 3 length =\", len(arr[1:5]))\nprint(\"secret:\", s3)\nprint(\"secret.length:\", len(s3))\n```\n\n## License\nThis code is under the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0).\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "ntc-pcrypto is a module python cryptography",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/congnghia0609/ntc-pcrypto"
    },
    "split_keywords": [
        "ntc-pcrypto",
        " pcrypto",
        " cryptography",
        " crypto",
        " encrypt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05399dd1102fecb34aa6496cac5777acd23db1303164535dd895e6b0cda8823d",
                "md5": "f7d0b22ec24917a5d8de41f35c269fcc",
                "sha256": "5aaaeb144798b5bade84961cf7f3468a43bfe6c828889dd45347cd9ab4b51424"
            },
            "downloads": -1,
            "filename": "ntc_pcrypto-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f7d0b22ec24917a5d8de41f35c269fcc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10146,
            "upload_time": "2024-10-26T19:33:29",
            "upload_time_iso_8601": "2024-10-26T19:33:29.115239Z",
            "url": "https://files.pythonhosted.org/packages/05/39/9dd1102fecb34aa6496cac5777acd23db1303164535dd895e6b0cda8823d/ntc_pcrypto-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ddc4b8bba038a9088812eca910d68aca8677b9ef2812c59953902c1c9fdd60f4",
                "md5": "bd1b16239831cf8fad5e8af9fcff8c88",
                "sha256": "1f115d7e938edf7804de468af7ed7cc496f31d8dd2792bfcdc195bbb8ee59c42"
            },
            "downloads": -1,
            "filename": "ntc-pcrypto-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bd1b16239831cf8fad5e8af9fcff8c88",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11225,
            "upload_time": "2024-10-26T19:33:31",
            "upload_time_iso_8601": "2024-10-26T19:33:31.771480Z",
            "url": "https://files.pythonhosted.org/packages/dd/c4/b8bba038a9088812eca910d68aca8677b9ef2812c59953902c1c9fdd60f4/ntc-pcrypto-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-26 19:33:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "congnghia0609",
    "github_project": "ntc-pcrypto",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "ntc-pcrypto"
}
        
Elapsed time: 0.75129s