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 wrap: on
line diff
--- a/apps/generate-config-files.py	Sat Mar 07 21:31:10 2009 +0100
+++ b/apps/generate-config-files.py	Tue Mar 10 08:58:34 2009 +0100
@@ -65,6 +65,8 @@
                   help="be quiet")
 parser.add_option("-n", "--players", dest="n", type="int",
                   help="number of players")
+parser.add_option("-k", "--keysize", dest="keysize", type="int", default=1024,
+                  help="Specify the key-size")
 parser.add_option("-t", "--threshold", dest="t", type="int",
                   help="threshold (it must hold that t < n/2)")
 parser.add_option("--skip-prss", action="store_true",
@@ -78,7 +80,7 @@
     parser.error("must supply a hostname:port argument for each player")
 
 addresses = [arg.split(':', 1) for arg in args]
-configs = generate_configs(options.n, options.t, addresses, options.prefix,
+configs = generate_configs(options.n, options.t, options.keysize, addresses, options.prefix,
                            options.skip_prss)
 
 for config in configs.itervalues():
--- a/viff/config.py	Sat Mar 07 21:31:10 2009 +0100
+++ b/viff/config.py	Tue Mar 10 08:58:34 2009 +0100
@@ -152,7 +152,7 @@
     return owner_id, players
 
 
-def generate_configs(n, t, addresses=None, prefix=None, skip_prss=False):
+def generate_configs(n, t, keysize, addresses=None, prefix=None, skip_prss=False):
     """Generate player configurations.
 
     Generates *n* configuration objects with a threshold of *t*. The
@@ -189,7 +189,7 @@
         return "Dealer " + str(dealer)
 
     # TODO: remove hard-coded key size.
-    key_pairs = dict([(p, paillier.generate_keys(1024)) for p in players])
+    key_pairs = dict([(p, paillier.generate_keys(keysize)) for p in players])
 
     configs = {}
     for p in players: