viff

changeset 1387:f3eed529bebe

active: kill unnecessary "inputters" argument
author Martin Geisler <mg@cs.au.dk>
date Wed, 04 Nov 2009 15:52:25 +0100
parents eacff336eeaa
children 1f0250d3bd69
files viff/active.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- a/viff/active.py	Wed Nov 04 15:46:56 2009 +0100
     1.2 +++ b/viff/active.py	Wed Nov 04 15:52:25 2009 +0100
     1.3 @@ -240,9 +240,10 @@
     1.4          # and we can safely return the first T shares.
     1.5          return (rvec1[:T], rvec2[:T])
     1.6  
     1.7 -    def _exchange_single(self, svec, rvec, T, field, degree, inputters):
     1.8 +    def _exchange_single(self, svec, rvec, T, field, degree):
     1.9          """Exchange and (if possible) verify shares."""
    1.10          pc = tuple(self.program_counter)
    1.11 +        inputters = range(1, self.num_players + 1)
    1.12  
    1.13          # We send our shares to the verifying players.
    1.14          for offset, share in enumerate(svec):
    1.15 @@ -269,10 +270,11 @@
    1.16          # do actual communication
    1.17          self.activate_reactor()
    1.18  
    1.19 -    def _exchange_double(self, shares, rvec1, rvec2, T, field, d1, d2, inputters):
    1.20 +    def _exchange_double(self, shares, rvec1, rvec2, T, field, d1, d2):
    1.21          """Exchange and (if possible) verify shares."""
    1.22          svec1, svec2 = shares
    1.23          pc = tuple(self.program_counter)
    1.24 +        inputters = range(1, self.num_players + 1)
    1.25  
    1.26          # We send our shares to the verifying players.
    1.27          for offset, (s1, s2) in enumerate(zip(svec1, svec2)):
    1.28 @@ -304,9 +306,10 @@
    1.29          # do actual communication
    1.30          self.activate_reactor()
    1.31  
    1.32 -    def _share_single(self, si, degree, field, inputters):
    1.33 +    def _share_single(self, si, degree, field):
    1.34          # TODO: Move common code between single_share and
    1.35          # double_share_random out to their own methods.
    1.36 +        inputters = range(1, self.num_players + 1)
    1.37          if self._hyper is None:
    1.38              self._hyper = hyper(self.num_players, field)
    1.39  
    1.40 @@ -324,13 +327,12 @@
    1.41          correct sharings of a random number using *degree* as the
    1.42          polynomial degree.
    1.43          """
    1.44 -        inputters = range(1, self.num_players + 1)
    1.45          # Generate a random element.
    1.46          si = rand.randint(0, field.modulus - 1)
    1.47 -        svec, rvec = self._share_single(si, degree, field, inputters)
    1.48 +        svec, rvec = self._share_single(si, degree, field)
    1.49          result = gather_shares(svec[T:])
    1.50          self.schedule_callback(result, self._exchange_single,
    1.51 -                               rvec, T, field, degree, inputters)
    1.52 +                               rvec, T, field, degree)
    1.53          return result
    1.54  
    1.55      def double_share_random(self, T, d1, d2, field):
    1.56 @@ -341,15 +343,14 @@
    1.57          double-sharings of a random number using *d1* and *d2* as the
    1.58          polynomial degrees.
    1.59          """
    1.60 -        inputters = range(1, self.num_players + 1)
    1.61          # Generate a random element.
    1.62          si = rand.randint(0, field.modulus - 1)
    1.63 -        svec1, rvec1 = self._share_single(si, d1, field, inputters)
    1.64 -        svec2, rvec2 = self._share_single(si, d2, field, inputters)
    1.65 +        svec1, rvec1 = self._share_single(si, d1, field)
    1.66 +        svec2, rvec2 = self._share_single(si, d2, field)
    1.67  
    1.68          result = gather_shares([gather_shares(svec1[T:]), gather_shares(svec2[T:])])
    1.69          self.schedule_callback(result, self._exchange_double,
    1.70 -                               rvec1, rvec2, T, field, d1, d2, inputters)
    1.71 +                               rvec1, rvec2, T, field, d1, d2)
    1.72          return result
    1.73  
    1.74      @preprocess("generate_triples")