ntc-pcrypto
ntc-pcrypto is a module python cryptography
Installation
From pip:
pip install ntc-pcrypto
From Source:
git clone https://github.com/congnghia0609/ntc-pcrypto.git
cd ntc-pcrypto
python3 setup.py install
Check version
pip show ntc-pcrypto
1. An implementation of Shamir's Secret Sharing Algorithm 256-bits in Python
Usage
Use encode/decode Base64URL
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
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.
Release files for ntc-pcrypto 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ntc-pcrypto-0.2.0.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ntc_pcrypto-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / ntc-pcrypto-0.2.0.tar.gz
| Download URL | ntc-pcrypto-0.2.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f115d7e938edf7804de468af7ed7cc496f31d8dd2792bfcdc195bbb8ee59c42
|
|
BLAKE2b-256 checksum How to use checksums |
ddc4b8bba038a9088812eca910d68aca8677b9ef2812c59953902c1c9fdd60f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / ntc_pcrypto-0.2.0-py3-none-any.whl
| Download URL | ntc_pcrypto-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5aaaeb144798b5bade84961cf7f3468a43bfe6c828889dd45347cd9ab4b51424
|
|
BLAKE2b-256 checksum How to use checksums |
05399dd1102fecb34aa6496cac5777acd23db1303164535dd895e6b0cda8823d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|