viff

changeset 1316:51280703f0c9

active: small cleanups in {single,double}_share_random
author Martin Geisler <mg@cs.au.dk>
date Thu, 22 Oct 2009 15:00:58 +0200
parents a0c405e7b2f8
children f933bd327750
files viff/active.py
diffstat 1 files changed, 6 insertions(+), 20 deletions(-) [+]
line diff
     1.1 --- a/viff/active.py	Thu Oct 22 14:25:50 2009 +0200
     1.2 +++ b/viff/active.py	Thu Oct 22 15:00:58 2009 +0200
     1.3 @@ -202,16 +202,8 @@
     1.4          si = rand.randint(0, field.modulus - 1)
     1.5  
     1.6          # Every player shares the random value with two thresholds.
     1.7 -        shares = self.shamir_share(inputters, field, si, degree)
     1.8 -
     1.9 -        # Turn the shares into a column vector.
    1.10 -        svec = Matrix([shares]).transpose()
    1.11 -
    1.12 -        # Apply the hyper-invertible matrix to svec1 and svec2.
    1.13 -        rvec = (self._hyper * svec)
    1.14 -
    1.15 -        # Get back to normal lists of shares.
    1.16 -        svec = svec.transpose().rows[0]
    1.17 +        svec = self.shamir_share(inputters, field, si, degree)
    1.18 +        rvec = self._hyper * Matrix([svec]).transpose()
    1.19          rvec = rvec.transpose().rows[0]
    1.20  
    1.21          def verify(shares):
    1.22 @@ -286,20 +278,14 @@
    1.23          si = rand.randint(0, field.modulus - 1)
    1.24  
    1.25          # Every player shares the random value with two thresholds.
    1.26 -        d1_shares = self.shamir_share(inputters, field, si, d1)
    1.27 -        d2_shares = self.shamir_share(inputters, field, si, d2)
    1.28 -
    1.29 -        # Turn the shares into a column vector.
    1.30 -        svec1 = Matrix([d1_shares]).transpose()
    1.31 -        svec2 = Matrix([d2_shares]).transpose()
    1.32 +        svec1 = self.shamir_share(inputters, field, si, d1)
    1.33 +        svec2 = self.shamir_share(inputters, field, si, d2)
    1.34  
    1.35          # Apply the hyper-invertible matrix to svec1 and svec2.
    1.36 -        rvec1 = (self._hyper * svec1)
    1.37 -        rvec2 = (self._hyper * svec2)
    1.38 +        rvec1 = self._hyper * Matrix([svec1]).transpose()
    1.39 +        rvec2 = self._hyper * Matrix([svec2]).transpose()
    1.40  
    1.41          # Get back to normal lists of shares.
    1.42 -        svec1 = svec1.transpose().rows[0]
    1.43 -        svec2 = svec2.transpose().rows[0]
    1.44          rvec1 = rvec1.transpose().rows[0]
    1.45          rvec2 = rvec2.transpose().rows[0]
    1.46