viff

changeset 1117:3fd216628718

Added parameter for specifying keysize to generate-config-files.py
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 10 Mar 2009 08:58:34 +0100
parents b71a37c3010e
children 88d6a083a513
files apps/generate-config-files.py viff/config.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/apps/generate-config-files.py	Sat Mar 07 21:31:10 2009 +0100
     1.2 +++ b/apps/generate-config-files.py	Tue Mar 10 08:58:34 2009 +0100
     1.3 @@ -65,6 +65,8 @@
     1.4                    help="be quiet")
     1.5  parser.add_option("-n", "--players", dest="n", type="int",
     1.6                    help="number of players")
     1.7 +parser.add_option("-k", "--keysize", dest="keysize", type="int", default=1024,
     1.8 +                  help="Specify the key-size")
     1.9  parser.add_option("-t", "--threshold", dest="t", type="int",
    1.10                    help="threshold (it must hold that t < n/2)")
    1.11  parser.add_option("--skip-prss", action="store_true",
    1.12 @@ -78,7 +80,7 @@
    1.13      parser.error("must supply a hostname:port argument for each player")
    1.14  
    1.15  addresses = [arg.split(':', 1) for arg in args]
    1.16 -configs = generate_configs(options.n, options.t, addresses, options.prefix,
    1.17 +configs = generate_configs(options.n, options.t, options.keysize, addresses, options.prefix,
    1.18                             options.skip_prss)
    1.19  
    1.20  for config in configs.itervalues():
     2.1 --- a/viff/config.py	Sat Mar 07 21:31:10 2009 +0100
     2.2 +++ b/viff/config.py	Tue Mar 10 08:58:34 2009 +0100
     2.3 @@ -152,7 +152,7 @@
     2.4      return owner_id, players
     2.5  
     2.6  
     2.7 -def generate_configs(n, t, addresses=None, prefix=None, skip_prss=False):
     2.8 +def generate_configs(n, t, keysize, addresses=None, prefix=None, skip_prss=False):
     2.9      """Generate player configurations.
    2.10  
    2.11      Generates *n* configuration objects with a threshold of *t*. The
    2.12 @@ -189,7 +189,7 @@
    2.13          return "Dealer " + str(dealer)
    2.14  
    2.15      # TODO: remove hard-coded key size.
    2.16 -    key_pairs = dict([(p, paillier.generate_keys(1024)) for p in players])
    2.17 +    key_pairs = dict([(p, paillier.generate_keys(keysize)) for p in players])
    2.18  
    2.19      configs = {}
    2.20      for p in players: