mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2024-11-25 19:51:04 +01:00
implemented functioning logik to create passwords
This commit is contained in:
parent
a0298d70bd
commit
80eb1f438b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
./data
|
16
Readme.md
Normal file
16
Readme.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Splitted Secret
|
||||
The purpose of this software is to splitt a secret over multiple people. Just if a defined amount of this people meet together they can encrypt the secret and have access to it.
|
||||
|
||||
# Requirements to know
|
||||
- Amount of People
|
||||
- How much people need to reunite for decrypting
|
||||
|
||||
# Requirements to implement
|
||||
- Plattform independend
|
||||
- easy to use
|
||||
|
||||
## Further Information
|
||||
- https://www.tutorialspoint.com/python/python_command_line_arguments.htm
|
||||
- https://docs.python.org/3/library/argparse.html#module-argparse
|
||||
- https://wiki.ubuntuusers.de/GoCryptFS/
|
||||
- https://pynative.com/python-generate-random-string/
|
0
scripts/decrypt.py
Normal file
0
scripts/decrypt.py
Normal file
0
scripts/encrypt.py
Normal file
0
scripts/encrypt.py
Normal file
@ -2,9 +2,10 @@ import argparse
|
||||
import random
|
||||
import string
|
||||
|
||||
|
||||
def getPassword():
|
||||
characters = string.ascii_letters + string.digits
|
||||
return ''.join(random.choice(characters) for i in range(int(128*quota_factor))).upper();
|
||||
return ''.join(random.choice(characters) for i in range(int(64*quota_factor))).upper();
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -14,35 +15,30 @@ if __name__ == '__main__':
|
||||
amount_of_secret_holders = args.amount_of_secret_holders;
|
||||
decryption_quota = args.decryption_quota;
|
||||
quota_factor=decryption_quota/100;
|
||||
password_divisor=int(amount_of_secret_holders*quota_factor)
|
||||
amount_of_partner_secrets=(amount_of_secret_holders * password_divisor)
|
||||
required_passwords=amount_of_partner_secrets * ( amount_of_secret_holders -1) ;
|
||||
password_group_members_amount=amount_of_secret_holders * quota_factor
|
||||
amount_of_partner_secrets=(amount_of_secret_holders * password_group_members_amount)
|
||||
#required_passwords=amount_of_partner_secrets * ( amount_of_secret_holders -1) ;
|
||||
required_passwords=amount_of_partner_secrets * amount_of_secret_holders;
|
||||
print(quota_factor);
|
||||
print(amount_of_secret_holders);
|
||||
print(decryption_quota);
|
||||
print(required_passwords);
|
||||
|
||||
# generate splitted password matrix
|
||||
secret_holders = {}
|
||||
password_groups = {}
|
||||
password_group_index = 0
|
||||
secret_holder_index = 0
|
||||
while password_group_index < required_passwords :
|
||||
password_groups[password_group_index] = {};
|
||||
password_groups[password_group_index]['members'] = {}
|
||||
password_groups[password_group_index]['password'] = ''
|
||||
group_members_count = 0;
|
||||
while group_members_count < password_group_members_amount :
|
||||
if secret_holder_index == amount_of_secret_holders:
|
||||
secret_holder_index = 0;
|
||||
|
||||
while secret_holder_index < amount_of_secret_holders:
|
||||
secret_holders[secret_holder_index] = {};
|
||||
partner_secret_holder_index = 0;
|
||||
while partner_secret_holder_index < amount_of_secret_holders:
|
||||
if partner_secret_holder_index != secret_holder_index :
|
||||
secret_holders[secret_holder_index][partner_secret_holder_index] = {};
|
||||
secret_holders[secret_holder_index][partner_secret_holder_index][secret_holder_index] = {};
|
||||
index=0
|
||||
while index < password_divisor:
|
||||
secret_holders[secret_holder_index][partner_secret_holder_index][secret_holder_index][index] = getPassword();
|
||||
index += 1;
|
||||
partner_secret_holder_index += 1;
|
||||
password_groups[password_group_index]['members'][secret_holder_index] = getPassword();
|
||||
password_groups[password_group_index]['password'] += ''.join(password_groups[password_group_index]['members'][secret_holder_index])
|
||||
secret_holder_index += 1;
|
||||
print(secret_holders);
|
||||
group_members_count += 1;
|
||||
password_group_index += 1;
|
||||
print(password_groups);
|
||||
|
||||
# generate passwords
|
||||
passwords = []
|
||||
while secret_holder_index < amount_of_secret_holders:
|
||||
|
||||
secret_holder_index += 1;
|
Loading…
Reference in New Issue
Block a user