Skip to content

Commit

Permalink
add information about algorithm to generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
Qbicz committed Jul 18, 2017
1 parent a0faa6a commit 37671ae
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/ui_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def load_public_info_dynamic(self):
self.gridLayoutWidget_dyn_reconstr)

self.textBrowser_dyn.append(
'Public info loaded. There are {} secrets.'.format(
self.secret_count))
'Public info loaded. There are {} secrets.\nThe algorithm is {}.'.format(
self.secret_count, self.public_info['algorithm']))
for secret, group in enumerate(access_structure):
self.textBrowser_dyn.append(
'Secret {} can be obtained by {}.'.format(secret, str(group)))
Expand Down Expand Up @@ -299,7 +299,8 @@ def save_pseudo_shares_to_file(self, dealer):
# TODO: add timestamps and FileChooser dialogs
public_info = {'prime': dealer.p,
'access_structures': dealer.access_structures,
'public_shares_M': dealer.public_shares_M}
'public_shares_M': dealer.public_shares_M,
'algorithm': self.algorithm}

public_info_json_string = jsonpickle.encode(public_info)
with open('public_info.json', 'w') as public_info_file:
Expand Down Expand Up @@ -330,6 +331,7 @@ def load_public_reconstruction_info(self):
return

self.public_info = jsonpickle.decode(json_string)
self.algorithm = self.public_info['algorithm']
print('loaded data from JSON', self.public_info)

def load_pseudo_shares_from_user(self, participant):
Expand Down Expand Up @@ -377,7 +379,7 @@ def combine_secret(self):
print('Wrong algorithm, cannot combine.')
return

print('Combine secret using', self.algorithm)
self.textBrowser_dyn.append('Combine secret using {} algorithm.'.format(self.algorithm))
combiner.public_shares_M = self.public_info['public_shares_M']
except AttributeError as e:
print('caught error %r' % e)
Expand Down

0 comments on commit 37671ae

Please sign in to comment.