viff

changeset 1023:18b700913f57

Cleanup the use of command line options.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 13 Nov 2008 17:51:34 +0100
parents 3e149ed5f49b
children e38873f66d4a
files apps/divide.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/apps/divide.py	Thu Nov 13 17:50:11 2008 +0100
     1.2 +++ b/apps/divide.py	Thu Nov 13 17:51:34 2008 +0100
     1.3 @@ -80,15 +80,15 @@
     1.4      parser.add_option("--modulus",
     1.5                       help="lower limit for modulus (can be an expression)")
     1.6  
     1.7 -    parser.set_defaults(modulus=2**65, number=None)
     1.8 +    parser.set_defaults(modulus=2**65)
     1.9  
    1.10      BasicRuntime.add_options(parser)
    1.11  
    1.12      options, args = parser.parse_args()
    1.13      if len(args)==2:
    1.14 -        options.number = int(args[1])
    1.15 +        number = int(args[1])
    1.16      else:
    1.17 -        options.number = None
    1.18 +        number = None
    1.19  
    1.20      if len(args) == 0:
    1.21          parser.error("you must specify a config file")
    1.22 @@ -105,12 +105,12 @@
    1.23          print "Connected."
    1.24  
    1.25          # Players 1 and 2 are doing a sharing over the field Zp.
    1.26 -        # Our input is options.number (none for other players).
    1.27 +        # Our input is number (none for other players).
    1.28          if runtime.id == 3:
    1.29              print "I have no number"
    1.30          else:
    1.31 -            print "My number: %d." % options.number
    1.32 -        (x, y) = runtime.shamir_share([1, 2], Zp, options.number)
    1.33 +            print "My number: %d." % number
    1.34 +        (x, y) = runtime.shamir_share([1, 2], Zp, number)
    1.35  
    1.36          # Do the secret computation.
    1.37          result = divide(x, y, 10) # 10 bits for the result.