viff

changeset 1291:73ca89381cfa

benchmark, orlandi: deleted trailing whitespace
author Martin Geisler <mg@cs.au.dk>
date Fri, 16 Oct 2009 19:01:27 +0200
parents 622bf474f8c8
children 9c49d09e2dac
files apps/benchmark.py apps/benchmark_classes.py viff/orlandi.py viff/test/test_orlandi_runtime.py
diffstat 4 files changed, 91 insertions(+), 91 deletions(-) [+]
line diff
     1.1 --- a/apps/benchmark.py	Fri Oct 16 19:00:14 2009 +0200
     1.2 +++ b/apps/benchmark.py	Fri Oct 16 19:01:27 2009 +0200
     1.3 @@ -92,14 +92,14 @@
     1.4                "triple_gen": ("triple_gen", [], NullaryOperation)}
     1.5  
     1.6  runtimes = {"PassiveRuntime": PassiveRuntime,
     1.7 -            "PaillierRuntime": PaillierRuntime, 
     1.8 +            "PaillierRuntime": PaillierRuntime,
     1.9              "BasicActiveRuntime": BasicActiveRuntime,
    1.10              "OrlandiRuntime": OrlandiRuntime}
    1.11  
    1.12 -mixins = {"TriplesHyperinvertibleMatricesMixin" : TriplesHyperinvertibleMatricesMixin, 
    1.13 -          "TriplesPRSSMixin": TriplesPRSSMixin, 
    1.14 +mixins = {"TriplesHyperinvertibleMatricesMixin" : TriplesHyperinvertibleMatricesMixin,
    1.15 +          "TriplesPRSSMixin": TriplesPRSSMixin,
    1.16            "ComparisonToft05Mixin": ComparisonToft05Mixin,
    1.17 -          "ComparisonToft07Mixin": ComparisonToft07Mixin, 
    1.18 +          "ComparisonToft07Mixin": ComparisonToft07Mixin,
    1.19            "ProbabilisticEqualityMixin": ProbabilisticEqualityMixin}
    1.20  
    1.21  parser = OptionParser(usage="Usage: %prog [options] config_file")
    1.22 @@ -136,7 +136,7 @@
    1.23  
    1.24  parser.set_defaults(modulus=2**65, threshold=1, count=10,
    1.25                      runtime="PassiveRuntime", mixins="", num_players=2, prss=True,
    1.26 -                    operation=operations.keys()[0], parallel=True, fake=False, 
    1.27 +                    operation=operations.keys()[0], parallel=True, fake=False,
    1.28                      args="", needed_data="")
    1.29  
    1.30  print "*" * 60
     2.1 --- a/apps/benchmark_classes.py	Fri Oct 16 19:00:14 2009 +0200
     2.2 +++ b/apps/benchmark_classes.py	Fri Oct 16 19:01:27 2009 +0200
     2.3 @@ -46,10 +46,10 @@
     2.4  
     2.5  class Benchmark(object):
     2.6      """Abstract base class for all Benchmarks.
     2.7 -    
     2.8 +
     2.9      For concrete classes see the `ParallelBenchmark` and `SequentialBenchmark` classes.
    2.10      A concrete class must be mixed with a `BenchmarkStrategy` and an `Operator`.
    2.11 -    """ 
    2.12 +    """
    2.13  
    2.14      def __init__(self, rt, operation, field, count):
    2.15          self.rt = rt
    2.16 @@ -57,7 +57,7 @@
    2.17          self.pc = None
    2.18          self.field = field
    2.19          self.count = count
    2.20 -        
    2.21 +
    2.22      def preprocess(self, needed_data):
    2.23          print "Preprocess", needed_data
    2.24          if needed_data:
    2.25 @@ -147,7 +147,7 @@
    2.26  
    2.27      An operation can be nullary, unary, binary, etc.
    2.28      """
    2.29 -    
    2.30 +
    2.31      def generate_operation_arguments(self, _):
    2.32          """Generate the input need for performing the operation.
    2.33  
    2.34 @@ -156,7 +156,7 @@
    2.35          raise NotImplemented("Override this abstract method in subclasses")
    2.36  
    2.37      def is_operation_done(self):
    2.38 -        """Returns true if there are no more operations to perform. 
    2.39 +        """Returns true if there are no more operations to perform.
    2.40          Used in sequential tests.
    2.41  
    2.42          Returns: Boolean.
    2.43 @@ -201,7 +201,7 @@
    2.44  
    2.45  class NullaryOperation(Operation):
    2.46      """A nullary operation."""
    2.47 -    
    2.48 +
    2.49      def generate_operation_arguments(self, _):
    2.50          self.nullary_tests = self.count
    2.51          return None
    2.52 @@ -233,7 +233,7 @@
    2.53  
    2.54  
    2.55  class NeededDataBenchmarkStrategy(BenchmarkStrategy):
    2.56 -    """In a needed data benchmark strategy, all the needed data has to have been generated 
    2.57 +    """In a needed data benchmark strategy, all the needed data has to have been generated
    2.58      before the test is run."""
    2.59  
    2.60      def benchmark(self, needed_data, pc, *args):
     3.1 --- a/viff/orlandi.py	Fri Oct 16 19:00:14 2009 +0200
     3.2 +++ b/viff/orlandi.py	Fri Oct 16 19:01:27 2009 +0200
     3.3 @@ -124,7 +124,7 @@
     3.4      def _expect_orlandi_share(self, peer_id, field):
     3.5          """Waits for a number ``x``, ``rho``, and the commitment for ``x``."""
     3.6          xi = self._expect_share(peer_id, field)
     3.7 -        Cx = Deferred()        
     3.8 +        Cx = Deferred()
     3.9          rhoi1 = self._expect_share(peer_id, field)
    3.10          rhoi2 = self._expect_share(peer_id, field)
    3.11          self._expect_data(peer_id, TEXT, Cx)
    3.12 @@ -170,12 +170,12 @@
    3.13      def secret_share(self, inputters, field, number=None, threshold=None):
    3.14          """Share the value, number, among all the parties using additive shareing.
    3.15  
    3.16 -        To share an element ``x in Z_p``, choose random ``x_1, ..., x_n-1 in Z_p``, 
    3.17 +        To share an element ``x in Z_p``, choose random ``x_1, ..., x_n-1 in Z_p``,
    3.18          define ``x_n = x - SUM_i=1^n-1 x_i mod p``.
    3.19  
    3.20 -        Choose random values ``rho_x1, ..., rho_xn in (Z_p)^2``, define 
    3.21 +        Choose random values ``rho_x1, ..., rho_xn in (Z_p)^2``, define
    3.22          ``rho_x = SUM_i=1^n rho_x,i`` and ``C_x = Com_ck(x, p_x)``.
    3.23 -        
    3.24 +
    3.25          Send ``[x]_i = (x_i, rho_xi, C_x)`` to party ``P_i``.
    3.26          """
    3.27          assert number is None or self.id in inputters
    3.28 @@ -186,14 +186,14 @@
    3.29          def additive_shares_with_rho(x):
    3.30              """Returns a tuple of a list of tuples (player id, share, rho) and rho.
    3.31  
    3.32 -            Chooses random elements ``x_1, ..., x_n-1`` in field and ``x_n`` st. 
    3.33 +            Chooses random elements ``x_1, ..., x_n-1`` in field and ``x_n`` st.
    3.34              ``x_n = x - Sum_i=1^n-1 x_i``.
    3.35  
    3.36              Chooses random pair of elements ``rho_1, ..., rho_n in Z_p^2``
    3.37              and define ``rho_n = Sum_i=1^n rho_i``.
    3.38  
    3.39              Returns a pair of ``((player id, x_i, rho_i), rho)``.
    3.40 -            """ 
    3.41 +            """
    3.42              shares = []
    3.43              rhos = []
    3.44              sum = 0
    3.45 @@ -206,7 +206,7 @@
    3.46                  sum += xi
    3.47                  rho1 += rhoi1
    3.48                  rho2 += rhoi2
    3.49 -                shares.append((i, xi, (rhoi1, rhoi2)))    
    3.50 +                shares.append((i, xi, (rhoi1, rhoi2)))
    3.51              xn = field(x) - sum
    3.52              rhon1 = field(rand.randint(0, field.modulus - 1))
    3.53              rhon2 = field(rand.randint(0, field.modulus - 1))
    3.54 @@ -245,7 +245,7 @@
    3.55  
    3.56          Every partyi broadcasts a share pair ``(x_i', rho_x,i')``.
    3.57  
    3.58 -        The parties compute the sums ``x'``, ``rho_x'`` and 
    3.59 +        The parties compute the sums ``x'``, ``rho_x'`` and
    3.60          check ``Com_ck(x',rho_x' = C_x``.
    3.61  
    3.62          If yes, return ``x = x'``, else else return :const:`None`.
    3.63 @@ -274,13 +274,13 @@
    3.64                  return x
    3.65              else:
    3.66                  #return x
    3.67 -                raise OrlandiException("Wrong commitment for value %s, %s, %s, found %s expected %s." % 
    3.68 +                raise OrlandiException("Wrong commitment for value %s, %s, %s, found %s expected %s." %
    3.69                                         (x, rho1, rho2, Cx1, Cx))
    3.70  
    3.71          def deserialize(ls):
    3.72              shares = [(field(long(x)), field(long(rho1)), field(long(rho2))) for x, rho1, rho2 in map(self.list_str, ls)]
    3.73              return shares
    3.74 -            
    3.75 +
    3.76          def exchange((xi, (rhoi1, rhoi2), Cx), receivers):
    3.77              # Send share to all receivers.
    3.78              ds = self.broadcast(self.players.keys(), receivers, str((str(xi.value), str(rhoi1.value), str(rhoi2.value))))
    3.79 @@ -304,7 +304,7 @@
    3.80      def random_share(self, field):
    3.81          """Generate a random share in the field, field.
    3.82  
    3.83 -        To generate a share of a random element ``r in Z_p``, party ``P_i`` 
    3.84 +        To generate a share of a random element ``r in Z_p``, party ``P_i``
    3.85          chooses at random ``r_i, rho_ri in Z_p X (Z_p)^2`` and
    3.86          broadcast ``C_r^i = Com_ck(r_i, rho_ri)``.
    3.87  
    3.88 @@ -317,7 +317,7 @@
    3.89          self.program_counter[-1] += 1
    3.90  
    3.91          # P_i chooses at random r_i, rho_ri in Z_p x (Z_p)^2
    3.92 -        ri = field(rand.randint(0, field.modulus - 1))     
    3.93 +        ri = field(rand.randint(0, field.modulus - 1))
    3.94          rhoi1 = field(rand.randint(0, field.modulus - 1))
    3.95          rhoi2 = field(rand.randint(0, field.modulus - 1))
    3.96  
    3.97 @@ -347,7 +347,7 @@
    3.98          self.activate_reactor()
    3.99  
   3.100          return s
   3.101 -    
   3.102 +
   3.103      def add(self, share_a, share_b):
   3.104          """Addition of shares.
   3.105  
   3.106 @@ -367,7 +367,7 @@
   3.107                  return OrlandiShare(self, field, v, rhov, Cv)
   3.108              return s
   3.109  
   3.110 -        # Either share_a or share_b must have an attribute called "field". 
   3.111 +        # Either share_a or share_b must have an attribute called "field".
   3.112          field = getattr(share_a, "field", getattr(share_b, "field", None))
   3.113  
   3.114          share_a = is_share(share_a, field)
   3.115 @@ -401,7 +401,7 @@
   3.116                  return OrlandiShare(self, field, v, rhov, Cv)
   3.117              return s
   3.118  
   3.119 -        # Either share_a or share_b must have an attribute called "field". 
   3.120 +        # Either share_a or share_b must have an attribute called "field".
   3.121          field = getattr(share_a, "field", getattr(share_b, "field", None))
   3.122  
   3.123          share_a = is_share(share_a, field)
   3.124 @@ -426,12 +426,12 @@
   3.125  
   3.126      def shift(self, inputters, field, number=None):
   3.127          """Shift of a share.
   3.128 -        
   3.129 +
   3.130          Useful for input.
   3.131  
   3.132          Communication cost: ???.
   3.133  
   3.134 -        Assume the parties are given a random share ``[r]`` by a trusted dealer. 
   3.135 +        Assume the parties are given a random share ``[r]`` by a trusted dealer.
   3.136          Then we denote the following protocol but ``[x] = Shift(P_i, x, [r])``.
   3.137  
   3.138          1. ``r = OpenTo(P_i, [r]``
   3.139 @@ -490,7 +490,7 @@
   3.140  
   3.141          if len(results) == 1:
   3.142               return results[0]
   3.143 -        return results       
   3.144 +        return results
   3.145  
   3.146      def mul(self, share_x, share_y):
   3.147          """Multiplication of shares.
   3.148 @@ -618,7 +618,7 @@
   3.149          """Multiplication of shares give a triple.
   3.150  
   3.151          Communication cost: ???.
   3.152 -        
   3.153 +
   3.154          ``d = Open([x] - [a])``
   3.155          ``e = Open([y] - [b])``
   3.156          ``[z] = e[x] + d[y] - [de] + [c]``
   3.157 @@ -692,13 +692,13 @@
   3.158          2. Compute::
   3.159  
   3.160               for j = 1, ..., 2d+1 do
   3.161 -             [F_j] = [x] + SUM_i=1^d [f_i]*j^i 
   3.162 +             [F_j] = [x] + SUM_i=1^d [f_i]*j^i
   3.163               and
   3.164               [G_j] = [y] + SUM_i=1^d [g_i]*j^i
   3.165  
   3.166          3. ``for j = 1, ..., 2d+1 do [H_j] = Mul([F_j], [G_j], [a_j], [b_j], [c_j])``
   3.167  
   3.168 -        4. compute ``[H_0] = SUM_j=1^2d+1 delta_j[H_j]`` where 
   3.169 +        4. compute ``[H_0] = SUM_j=1^2d+1 delta_j[H_j]`` where
   3.170             ``delta_j = PRODUCT_k=1, k!=j^2d+1 k/(k-j)``
   3.171  
   3.172          5. output ``[z] = [H_0]``
   3.173 @@ -738,9 +738,9 @@
   3.174  #             print "f:", f
   3.175  #             print "g:", g
   3.176              # 2) for j = 1, ..., 2d+1 do
   3.177 -            # [F_j] = [x] + SUM_i=1^d [f_i]*j^i 
   3.178 +            # [F_j] = [x] + SUM_i=1^d [f_i]*j^i
   3.179              # and
   3.180 -            # [G_j] = [y] + SUM_i=1^d [g_i]*j^i 
   3.181 +            # [G_j] = [y] + SUM_i=1^d [g_i]*j^i
   3.182              h0i, rhoh0, Ch0 = self._additive_constant(field(0), n)
   3.183              H0 = OrlandiShare(self, field, h0i, rhoh0, Ch0)
   3.184              xi, (rhoxi1, rhoxi2), Cx = x
   3.185 @@ -752,9 +752,9 @@
   3.186                  rho2_Fji = rhoxi2
   3.187                  C_Fji = Cx
   3.188                  if f != []:
   3.189 -                    # SUM_i=1^d [f_i]*j^i 
   3.190 +                    # SUM_i=1^d [f_i]*j^i
   3.191                      vi, (rhovi1, rhovi2), Cv = self.sum_poly(j, f)
   3.192 -                    # [F_j] = [x] + SUM_i=1^d [f_i]*j^i 
   3.193 +                    # [F_j] = [x] + SUM_i=1^d [f_i]*j^i
   3.194                      Fji += vi
   3.195                      rho1_Fji += rhovi1
   3.196                      rho2_Fji += rhovi2
   3.197 @@ -764,7 +764,7 @@
   3.198                  rho2_Gji = rhoyi2
   3.199                  C_Gji = Cy
   3.200                  if g != []:
   3.201 -                    # SUM_i=1^d [g_i]*j^i 
   3.202 +                    # SUM_i=1^d [g_i]*j^i
   3.203                      wi, (rhowi1, rhowi2), Cw = self.sum_poly(j, g)
   3.204                      # [G_j] = [y] + SUM_i=1^d [g_i]*j^i
   3.205                      Gji += wi
   3.206 @@ -813,7 +813,7 @@
   3.207  
   3.208                  i. choose random ``d_ij in Z_p^3``
   3.209  
   3.210 -                ii. compute and send 
   3.211 +                ii. compute and send
   3.212                      ``gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij`` to ``P_i``.
   3.213  
   3.214  
   3.215 @@ -821,13 +821,13 @@
   3.216  
   3.217             a. compute ``c_i = SUM_j Dec_sk_i(gamma_ij) - SUM_j d_ij mod p``
   3.218  
   3.219 -           b. pick random ``t_i in (Z_p)^2``, compute and 
   3.220 +           b. pick random ``t_i in (Z_p)^2``, compute and
   3.221                broadcast ``C_i = Com_ck(c_i, t_i)``
   3.222  
   3.223          4. Everyone computes:
   3.224             ``(A, B, C) = (PRODUCT_i A_i, PRODUCT_i B_i, PRODUCT_i C_i)``
   3.225 -        
   3.226 -        5. Every party ``P_i`` outputs shares ``[a_i] = (a_i, r_i, A)``, 
   3.227 +
   3.228 +        5. Every party ``P_i`` outputs shares ``[a_i] = (a_i, r_i, A)``,
   3.229             ``[b_i] = (b_i, s_i, B)``, and ``[c_i] = (c_i, t_i, C)``.
   3.230  
   3.231          """
   3.232 @@ -856,8 +856,8 @@
   3.233                    ``A = PRODUCT_i A_i``
   3.234                    ``B = PRODUCT_i B_i``
   3.235                    ``C = PRODUCT_i C_i``
   3.236 -        
   3.237 -               5) Every party ``P_i`` outputs shares ``[a_i] = (a_i, r_i, A)``, 
   3.238 +
   3.239 +               5) Every party ``P_i`` outputs shares ``[a_i] = (a_i, r_i, A)``,
   3.240                    ``[b_i] = (b_i, s_i, B)``, and ``[c_i] = (c_i, t_i, C)``.
   3.241              """
   3.242              A = product(As)
   3.243 @@ -877,10 +877,10 @@
   3.244  
   3.245          def step3(gammas, alphas, alpha_randomness, As, Bs, ai, bi, r, s, dijs):
   3.246              """3) Every party ``P_i`` does:
   3.247 -                  (a) compute 
   3.248 +                  (a) compute
   3.249                    ``c_i = SUM_j Dec_sk_i(gamma_ij) - SUM_j d_ji mod p``
   3.250  
   3.251 -                  (b) pick random ``t_i in (Z_p)^2``, compute and 
   3.252 +                  (b) pick random ``t_i in (Z_p)^2``, compute and
   3.253                        broadcast ``C_i = Com_ck(c_i, t_i)``
   3.254              """
   3.255              # c_i = SUM_j Dec_sk_i(gamma_ij) - SUM_j d_ji mod p.
   3.256 @@ -892,18 +892,18 @@
   3.257              t = (t1, t2)
   3.258              # C_i = Com_ck(c_i, t_i).
   3.259              Ci = commitment.commit(ci.value, t1.value, t2.value)
   3.260 -            
   3.261 +
   3.262              # Broadcast Ci.
   3.263              Cs = self.broadcast(self.players.keys(), self.players.keys(), repr(Ci))
   3.264              result = gatherResults(Cs)
   3.265 -            result.addCallbacks(step45, self.error_handler, callbackArgs=(alphas, gammas, alpha_randomness, 
   3.266 +            result.addCallbacks(step45, self.error_handler, callbackArgs=(alphas, gammas, alpha_randomness,
   3.267                                                                            As, Bs, ai, bi, ci, r, s, t, dijs))
   3.268              return result
   3.269  
   3.270          def step2c(Bs, As, alphas, alpha_randomness, ai, bj, r, s):
   3.271              """(c) P_j do, towards every other party:
   3.272                     i. choose random d_i,j in Z_p^3
   3.273 -                   ii. compute and send 
   3.274 +                   ii. compute and send
   3.275              gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij to P_i.
   3.276              """
   3.277  
   3.278 @@ -935,7 +935,7 @@
   3.279                  dijs[pi - 1] = dij
   3.280                  results[pi - 1] = d
   3.281              result = gatherResults(results)
   3.282 -            self.schedule_callback(result, step3, alphas, alpha_randomness, 
   3.283 +            self.schedule_callback(result, step3, alphas, alpha_randomness,
   3.284                                     As, Bs, ai, bj, r, s, dijs)
   3.285              result.addErrback(self.error_handler)
   3.286              return result
   3.287 @@ -956,11 +956,11 @@
   3.288              # Broadcast B_j.
   3.289              results = self.broadcast(self.players.keys(), self.players.keys(), repr(Bj))
   3.290              result = gatherResults(results)
   3.291 -            self.schedule_callback(result, step2c, As, alphas, alpha_randomness, 
   3.292 +            self.schedule_callback(result, step2c, As, alphas, alpha_randomness,
   3.293                                     ai, bj, r, (s1, s2))
   3.294              result.addErrback(self.error_handler)
   3.295              return result
   3.296 -        
   3.297 +
   3.298          # 1) Every party P_i chooses random values a_i, r_i in Z_p X (Z_p)^2,
   3.299          #    compute alpha_i = Enc_eki(a_i) and Ai = Com_ck(a_i, r_i), and
   3.300          #    broadcast them.
   3.301 @@ -970,7 +970,7 @@
   3.302          r1 = random_number(field.modulus)
   3.303          r2 = random_number(field.modulus)
   3.304  
   3.305 -        # compute alpha_i = Enc_eki(a_i) 
   3.306 +        # compute alpha_i = Enc_eki(a_i)
   3.307          n, g = self.players[self.id].pubkey
   3.308          alpha_randomness = rand.randint(1, long(n))
   3.309          alphai = encrypt_r(ai.value, alpha_randomness, (n, g))
   3.310 @@ -993,23 +993,23 @@
   3.311          self.schedule_callback(result, step2ab, ai, (r1, r2), alpha_randomness)
   3.312          result.addErrback(self.error_handler)
   3.313          return result
   3.314 -    
   3.315 +
   3.316      def triple_test(self, field):
   3.317          """Generate a triple ``(a, b, c)`` where ``c = a * b``.
   3.318  
   3.319 -        The triple ``(a, b, c)`` is checked against the 
   3.320 +        The triple ``(a, b, c)`` is checked against the
   3.321          triple ``(x, y, z)`` and a random value ``r``.
   3.322  
   3.323          """
   3.324          triple1 = self.triple_gen(field)
   3.325          triple2 = self.triple_gen(field)
   3.326          r = self.open(self.random_share(field))
   3.327 -        
   3.328 +
   3.329          def check((v, oa, ob, oc, ox, oy, oz), a, b, c, ec):
   3.330              if v is 0:
   3.331                  return None
   3.332              return (a, b, c, ec)
   3.333 -        
   3.334 +
   3.335          def compute_value(((a, b, c, ec), (x, y, z, _), r)):
   3.336              oa = self.open(a)
   3.337              ob = self.open(b)
   3.338 @@ -1071,10 +1071,10 @@
   3.339              r = self.output(r)
   3.340              self.schedule_callback(r, coin_flip, ls, [])
   3.341              r.addErrback(self.error_handler)
   3.342 -            return r            
   3.343 +            return r
   3.344  
   3.345          def step45(lists):
   3.346 -            """For all i in test_set the parties reveal 
   3.347 +            """For all i in test_set the parties reveal
   3.348              the randomness used for TripleTest() and checks that
   3.349              the randomness is consistent with the actual values."""
   3.350              M_without_test_set = lists[0]
   3.351 @@ -1099,15 +1099,15 @@
   3.352                  return (share, rho1, rho2, commitment)
   3.353  
   3.354              def send_share(player_id, pc, a):
   3.355 -                self._send_orlandi_share(player_id, pc, a.share, a.rho, a.commitment) 
   3.356 -                
   3.357 +                self._send_orlandi_share(player_id, pc, a.share, a.rho, a.commitment)
   3.358 +
   3.359              def receive_shares(player_id):
   3.360                  Cx = Deferred()
   3.361                  xi = self._expect_share(player_id, field)
   3.362                  rho1 = self._expect_share(player_id, field)
   3.363                  rho2 = self._expect_share(player_id, field)
   3.364                  self._expect_data(player_id, TEXT, Cx)
   3.365 -                Cx.addCallbacks(lambda Cx: commitment.deserialize(Cx), 
   3.366 +                Cx.addCallbacks(lambda Cx: commitment.deserialize(Cx),
   3.367                                          self.error_handler)
   3.368                  return gatherResults([xi, rho1, rho2, Cx])
   3.369  
   3.370 @@ -1145,7 +1145,7 @@
   3.371                  c = 0
   3.372                  c_rho1 = 0
   3.373                  c_rho2 = 0
   3.374 -                
   3.375 +
   3.376                  for x in xrange(len(ais)):
   3.377                      (ai, a_rhoi1, a_rhoi2, A) = ais[x]
   3.378                      (bi, b_rhoi1, b_rhoi2, B) = bis[x]
   3.379 @@ -1283,12 +1283,12 @@
   3.380              self.schedule_callback(r, put_in_set, M_without_test_set, subsets)
   3.381              r.addErrback(self.error_handler)
   3.382              return r
   3.383 -            
   3.384 +
   3.385  
   3.386          def step7(Msets):
   3.387              """For i = 1,...,M do:
   3.388              a) [a] <- Fpp(rand,...), [b] <- Fpp(rand,...)
   3.389 -            b) [r] <- Fpp(rand,...), 
   3.390 +            b) [r] <- Fpp(rand,...),
   3.391              c) [c] <- LTMUL([a], [b], M_i)
   3.392              d) Open([c] + [r])
   3.393              """
     4.1 --- a/viff/test/test_orlandi_runtime.py	Fri Oct 16 19:00:14 2009 +0200
     4.2 +++ b/viff/test/test_orlandi_runtime.py	Fri Oct 16 19:01:27 2009 +0200
     4.3 @@ -96,19 +96,19 @@
     4.4          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
     4.5  
     4.6          def check(v):
     4.7 -            self.assertEquals(True, True)           
     4.8 +            self.assertEquals(True, True)
     4.9  
    4.10          x = runtime.random_share(self.Zp)
    4.11          d = runtime.open(x)
    4.12          d.addCallback(check)
    4.13          return d
    4.14 - 
    4.15 +
    4.16      @protocol
    4.17      def test_sum(self, runtime):
    4.18          """Test addition of two numbers."""
    4.19  
    4.20          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
    4.21 - 
    4.22 +
    4.23          x1 = 42
    4.24          y1 = 7
    4.25  
    4.26 @@ -187,7 +187,7 @@
    4.27  
    4.28          x1 = 42
    4.29          y1 = 7
    4.30 - 
    4.31 +
    4.32          def check(v):
    4.33              self.assertEquals(v, x1 - y1)
    4.34  
    4.35 @@ -258,10 +258,10 @@
    4.36  
    4.37  class OrlandiAdvancedCommandsTest(RuntimeTestCase):
    4.38      """Test for advanced commands."""
    4.39 -    
    4.40 +
    4.41      # Number of players.
    4.42      num_players = 3
    4.43 - 
    4.44 +
    4.45      runtime_class = OrlandiRuntime
    4.46  
    4.47      timeout = 800
    4.48 @@ -271,10 +271,10 @@
    4.49          """Test addition of the shift command."""
    4.50  
    4.51          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
    4.52 -        
    4.53 +
    4.54          def check(v):
    4.55              self.assertEquals(v, 42)
    4.56 - 
    4.57 +
    4.58          x = runtime.shift([2], self.Zp, 42)
    4.59          d = runtime.open(x)
    4.60          d.addCallback(check)
    4.61 @@ -285,10 +285,10 @@
    4.62          """Test addition of the shift command."""
    4.63  
    4.64          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
    4.65 -        
    4.66 +
    4.67          def check(v):
    4.68              self.assertEquals(v, 42)
    4.69 - 
    4.70 +
    4.71          x, y = runtime.shift([1,3], self.Zp, 42)
    4.72          d1 = runtime.open(x)
    4.73          d1.addCallback(check)
    4.74 @@ -301,11 +301,11 @@
    4.75          """Test addition of the shift command."""
    4.76  
    4.77          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
    4.78 -        
    4.79 +
    4.80          def r1(ls):
    4.81              x, y = ls
    4.82              self.assertEquals(runtime.program_counter, [4])
    4.83 - 
    4.84 +
    4.85          x = runtime.shift([1], self.Zp, 42)
    4.86          y = runtime.shift([2], self.Zp, 42)
    4.87          r = gather_shares([x, y])
    4.88 @@ -317,14 +317,14 @@
    4.89          """Test addition of the shift command."""
    4.90  
    4.91          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
    4.92 -        
    4.93 +
    4.94          def check(v):
    4.95              self.assertEquals(v, 42)
    4.96  
    4.97          def r1((x, y)):
    4.98              self.assertEquals(x, 42)
    4.99              self.assertEquals(y, 42)
   4.100 - 
   4.101 +
   4.102          x = runtime.shift([1], self.Zp, 42)
   4.103          y = runtime.shift([2], self.Zp, 42)
   4.104          r = gather_shares([runtime.open(x), runtime.open(y)])
   4.105 @@ -361,10 +361,10 @@
   4.106  
   4.107          x1 = 42
   4.108          y1 = 7
   4.109 - 
   4.110 +
   4.111          def check(v):
   4.112              self.assertEquals(v, x1 * y1)
   4.113 - 
   4.114 +
   4.115          x2 = runtime.shift([2], self.Zp, x1)
   4.116          y2 = runtime.shift([3], self.Zp, y1)
   4.117  
   4.118 @@ -382,10 +382,10 @@
   4.119  
   4.120          x1 = 42
   4.121          y1 = 7
   4.122 - 
   4.123 +
   4.124          def check(v):
   4.125              self.assertEquals(v, x1 * y1)
   4.126 - 
   4.127 +
   4.128          x2 = runtime.shift([2], self.Zp, x1)
   4.129          y2 = runtime.shift([3], self.Zp, y1)
   4.130  
   4.131 @@ -494,7 +494,7 @@
   4.132          f.append((self.Zp(7), (self.Zp(7), self.Zp(7)), self.Zp(7)))
   4.133          f.append((self.Zp(9), (self.Zp(9), self.Zp(9)), self.Zp(9)))
   4.134          f.append((self.Zp(13), (self.Zp(13), self.Zp(13)), self.Zp(13)))
   4.135 -        
   4.136 +
   4.137          x, (rho1, rho2), Cx = runtime.sum_poly(1, f)
   4.138          self.assertEquals(x, 29)
   4.139          self.assertEquals(rho1, 29)
   4.140 @@ -507,7 +507,7 @@
   4.141          """Test implementation of sum_poly."""
   4.142  
   4.143          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
   4.144 -        
   4.145 +
   4.146          Cf1 = commitment.commit(21, 21, 21)
   4.147          Cf2 = commitment.commit(27, 27, 27)
   4.148          Cf3 = commitment.commit(39, 39, 39)
   4.149 @@ -516,7 +516,7 @@
   4.150          f.append((self.Zp(7), (self.Zp(7), self.Zp(7)), Cf1))
   4.151          f.append((self.Zp(9), (self.Zp(9), self.Zp(9)), Cf2))
   4.152          f.append((self.Zp(13), (self.Zp(13), self.Zp(13)), Cf3))
   4.153 -        
   4.154 +
   4.155          x, (rho1, rho2), Cx = runtime.sum_poly(3, f)
   4.156          self.assertEquals(x, 453)
   4.157          self.assertEquals(rho1, 453)
   4.158 @@ -538,7 +538,7 @@
   4.159          self.assertEquals(delta[4], 21)
   4.160          self.assertEquals(delta[5], -7)
   4.161          self.assertEquals(delta[6], 1)
   4.162 - 
   4.163 +
   4.164          return delta
   4.165  
   4.166      @protocol
   4.167 @@ -547,7 +547,7 @@
   4.168          commitment.set_reference_string(long(2), long(6))
   4.169  
   4.170          self.Zp = GF(6277101735386680763835789423176059013767194773182842284081)
   4.171 -       
   4.172 +
   4.173          x1 = 42
   4.174          y1 = 7
   4.175  
   4.176 @@ -555,7 +555,7 @@
   4.177  
   4.178          def check(v):
   4.179              self.assertEquals(v, x1 * y1)
   4.180 - 
   4.181 +
   4.182          x2 = runtime.shift([1], self.Zp, x1)
   4.183          y2 = runtime.shift([2], self.Zp, y1)
   4.184  
   4.185 @@ -578,9 +578,9 @@
   4.186  
   4.187      # Number of players.
   4.188      num_players = 3
   4.189 - 
   4.190 +
   4.191      runtime_class = OrlandiRuntime
   4.192 - 
   4.193 +
   4.194      timeout = 1600
   4.195  
   4.196      @protocol