### changeset 1316:51280703f0c9

active: small cleanups in {single,double}_share_random
author Martin Geisler Thu, 22 Oct 2009 15:00:58 +0200 a0c405e7b2f8 f933bd327750 viff/active.py 1 files changed, 6 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
```--- a/viff/active.py	Thu Oct 22 14:25:50 2009 +0200
+++ b/viff/active.py	Thu Oct 22 15:00:58 2009 +0200
@@ -202,16 +202,8 @@
si = rand.randint(0, field.modulus - 1)

# Every player shares the random value with two thresholds.
-        shares = self.shamir_share(inputters, field, si, degree)
-
-        # Turn the shares into a column vector.
-        svec = Matrix([shares]).transpose()
-
-        # Apply the hyper-invertible matrix to svec1 and svec2.
-        rvec = (self._hyper * svec)
-
-        # Get back to normal lists of shares.
-        svec = svec.transpose().rows[0]
+        svec = self.shamir_share(inputters, field, si, degree)
+        rvec = self._hyper * Matrix([svec]).transpose()
rvec = rvec.transpose().rows[0]

def verify(shares):
@@ -286,20 +278,14 @@
si = rand.randint(0, field.modulus - 1)

# Every player shares the random value with two thresholds.
-        d1_shares = self.shamir_share(inputters, field, si, d1)
-        d2_shares = self.shamir_share(inputters, field, si, d2)
-
-        # Turn the shares into a column vector.
-        svec1 = Matrix([d1_shares]).transpose()
-        svec2 = Matrix([d2_shares]).transpose()
+        svec1 = self.shamir_share(inputters, field, si, d1)
+        svec2 = self.shamir_share(inputters, field, si, d2)

# Apply the hyper-invertible matrix to svec1 and svec2.
-        rvec1 = (self._hyper * svec1)
-        rvec2 = (self._hyper * svec2)
+        rvec1 = self._hyper * Matrix([svec1]).transpose()
+        rvec2 = self._hyper * Matrix([svec2]).transpose()

# Get back to normal lists of shares.
-        svec1 = svec1.transpose().rows[0]
-        svec2 = svec2.transpose().rows[0]
rvec1 = rvec1.transpose().rows[0]
rvec2 = rvec2.transpose().rows[0]
```