initial save of my chatGPT coding

This commit is contained in:
kalzu
2022-12-17 22:39:21 +02:00
commit 56cd2a3f3f
37 changed files with 1376 additions and 0 deletions

View File

@ -0,0 +1,30 @@
#!/usr/bin/python3
from secretsharing import PlaintextToHexSecretSharer
# The secret that we want to split
secret = "my_secret_password"
# The number of shares that we want to generate
n_shares = 5
# The threshold (i.e., the minimum number of shares required to reconstruct the secret)
threshold = 3
# Generate the shares
shares = PlaintextToHexSecretSharer.split_secret(secret, n_shares, threshold)
# Print the shares
for share in shares:
print(share)
# To reconstruct the secret, we need at least the threshold number of shares
# Let's say we have these three shares:
shares_to_reconstruct = [shares[0], shares[2], shares[4]]
# Reconstruct the secret
secret = PlaintextToHexSecretSharer.recover_secret(shares_to_reconstruct)
# Print the secret
print(secret)