viff

changeset 930:a1aa8bc840e1

Use Shamir instead of PRSS to generate shares.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 17 Sep 2008 15:01:13 +0200
parents 1d8345e936a0
children 4237dbc953fd
files apps/benchmark.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/apps/benchmark.py	Wed Sep 17 14:59:43 2008 +0200
     1.2 +++ b/apps/benchmark.py	Wed Sep 17 15:01:13 2008 +0200
     1.3 @@ -68,7 +68,7 @@
     1.4  from viff.comparison import ComparisonToft05Mixin, ComparisonToft07Mixin
     1.5  from viff.paillier import PaillierRuntime
     1.6  from viff.config import load_config
     1.7 -from viff.util import find_prime
     1.8 +from viff.util import find_prime, rand
     1.9  
    1.10  last_timestamp = time.time()
    1.11  start = 0
    1.12 @@ -178,9 +178,18 @@
    1.13              self.begin(None)
    1.14  
    1.15      def begin(self, _):
    1.16 -        print "Runtime ready, starting protocol"
    1.17 -        self.a_shares = [self.rt.prss_share_random(Zp) for _ in range(count)]
    1.18 -        self.b_shares = [self.rt.prss_share_random(Zp) for _ in range(count)]
    1.19 +        print "Runtime ready, generating shares"
    1.20 +        self.a_shares = []
    1.21 +        self.b_shares = []
    1.22 +        for i in range(count):
    1.23 +            inputter = (i % len(self.rt.players)) + 1
    1.24 +            if inputter == self.rt.id:
    1.25 +                a = rand.randint(0, Zp.modulus)
    1.26 +                b = rand.randint(0, Zp.modulus)
    1.27 +            else:
    1.28 +                a, b = None, None
    1.29 +            self.a_shares.append(self.rt.shamir_share([inputter], Zp, a))
    1.30 +            self.b_shares.append(self.rt.shamir_share([inputter], Zp, b))
    1.31          shares_ready = gather_shares(self.a_shares + self.b_shares)
    1.32          shares_ready.addCallback(self.sync_test)
    1.33