viff

changeset 1346:e72cd064566d

Orlandi: Remove dead code.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 27 Oct 2009 19:08:30 +0100
parents c2a553514804
children c12e4a568741
files viff/orlandi.py
diffstat 1 files changed, 3 insertions(+), 31 deletions(-) [+]
line diff
     1.1 --- a/viff/orlandi.py	Tue Oct 27 19:08:29 2009 +0100
     1.2 +++ b/viff/orlandi.py	Tue Oct 27 19:08:30 2009 +0100
     1.3 @@ -150,28 +150,6 @@
     1.4          sls.addCallbacks(combine, self.error_handler)
     1.5          return sls
     1.6  
     1.7 -    def _expect_orlandi_share_xi_rhoi(self, peer_id, field):
     1.8 -        xi = self._expect_share(peer_id, field)
     1.9 -        rhoi1 = self._expect_share(peer_id, field)
    1.10 -        rhoi2 = self._expect_share(peer_id, field)
    1.11 -        sls = ShareList([xi, rhoi1, rhoi2])
    1.12 -        def combine(ls):
    1.13 -            expected_num = 3;
    1.14 -            if len(ls) is not expected_num:
    1.15 -                raise OrlandiException("Cannot share number, trying to create a share,"
    1.16 -                                       " expected %s components got %s."
    1.17 -                                       % (expected_num, len(ls)))
    1.18 -
    1.19 -            s1, xi = ls[0]
    1.20 -            s2, rhoi1 = ls[1]
    1.21 -            s3, rhoi2 = ls[2]
    1.22 -            if not (s1 and s2 and s3):
    1.23 -                raise OrlandiException("Cannot share number, trying to create share "
    1.24 -                                       "but a component did arrive properly.")
    1.25 -            return OrlandiShare(self, field, xi, (rhoi1, rhoi2))
    1.26 -        sls.addCallbacks(combine, self.error_handler)
    1.27 -        return sls
    1.28 -
    1.29      def secret_share(self, inputters, field, number=None, threshold=None):
    1.30          """Share the value *number* among all the parties using
    1.31          additive sharing.
    1.32 @@ -1020,23 +998,17 @@
    1.33          triple2 = self.triple_gen(field)
    1.34          r = self.open(self.random_share(field))
    1.35  
    1.36 -        def check((v, oa, ob, oc, ox, oy, oz), a, b, c, ec):
    1.37 -            if v is 0:
    1.38 +        def check(v, a, b, c, ec):
    1.39 +            if v.value != 0:
    1.40                  return None
    1.41              return (a, b, c, ec)
    1.42  
    1.43          def compute_value(((a, b, c, ec), (x, y, z, _), r)):
    1.44 -            oa = self.open(a)
    1.45 -            ob = self.open(b)
    1.46 -            oc = self.open(c)
    1.47 -            ox = self.open(x)
    1.48 -            oy = self.open(y)
    1.49 -            oz = self.open(z)
    1.50              l = self._cmul(r, x, field)
    1.51              m = self._cmul(r, y, field)
    1.52              n = self._cmul(r*r, z, field)
    1.53              d = c - self._basic_multiplication(a, b, l, m, n)
    1.54 -            r = gather_shares([d, oa, ob, oc, ox, oy, oz])
    1.55 +            r = self.open(d)
    1.56              r.addCallbacks(check, self.error_handler, callbackArgs=(a, b, c, ec))
    1.57              return r
    1.58