Uses Mersenne prime field (2ยนยฒโท-1) for cryptographic operations. Resistant to brute-force attacks.
Split text, files, or binary data. Automatic chunking for secrets >1MB.
Python API, command-line tool, and web interface with Flask.
from shamir_ss import generate_text_shares, reconstruct_text_secret
def main():
secret = "My top secret"
shares = generate_text_shares(secret, 3, 5)
reconstructed = reconstruct_text_secret(shares[:3])
print(reconstructed)
if __name__ == "__main__":
main()
Python Examples โ
python -m shamir_ss <command> <...args>
shamir_ss --help # Show all commands
shamir_ss split --help # Split command help
shamir_ss combine --help # Combine command help
shamir_ss help # Detailed usage examples
python -m shamir_ss split \
--secret "My top secret" \
-t 3 -n 5 \
--output shares
Split secret to 5 shares with treshold 3 and put output to shares dir
python -m shamir_ss combine \
-i shares
Reconstruct secret from shares dir w/o hash validation (will be prompted interactively)
shamir_ss combine --text
Reconstruct secret using interactive modeCLI Reference Guide โ
# Launch web client
python -m client
# Access at http://localhost:5000
Web UI Documentation โ
Polynomial Generation: Creates a (t-1)-degree polynomial with the secret as the constant term.
Share Distribution: Evaluates the polynomial at n distinct points to generate shares.
Reconstruction: Uses Lagrange interpolation on any t shares to recover the secret.
pip install shamir_ss
pip install git+https://github.com/Team-Hype/shamir-secret-sharing