ntc-pcrypto is a module python cryptography
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ntc-pcrypto-0.2.0.tar.gz
(11.2 kB
view details)
Built Distribution
File details
Details for the file ntc-pcrypto-0.2.0.tar.gz
.
File metadata
- Download URL: ntc-pcrypto-0.2.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f115d7e938edf7804de468af7ed7cc496f31d8dd2792bfcdc195bbb8ee59c42 |
|
MD5 | bd1b16239831cf8fad5e8af9fcff8c88 |
|
BLAKE2b-256 | ddc4b8bba038a9088812eca910d68aca8677b9ef2812c59953902c1c9fdd60f4 |
File details
Details for the file ntc_pcrypto-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: ntc_pcrypto-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aaaeb144798b5bade84961cf7f3468a43bfe6c828889dd45347cd9ab4b51424 |
|
MD5 | f7d0b22ec24917a5d8de41f35c269fcc |
|
BLAKE2b-256 | 05399dd1102fecb34aa6496cac5777acd23db1303164535dd895e6b0cda8823d |