viff

changeset 1400:3a225dcdaccb

Orlandi: Made dijs be longs instead of fields.
author Thomas P Jakobsen <tpj@cs.au.dk>
date Fri, 27 Nov 2009 16:25:50 +0100
parents 2cbe81569dd0
children 4e9747693979
files viff/orlandi.py
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line diff
     1.1 --- a/viff/orlandi.py	Fri Nov 27 16:13:56 2009 +0100
     1.2 +++ b/viff/orlandi.py	Fri Nov 27 16:25:50 2009 +0100
     1.3 @@ -926,11 +926,7 @@
     1.4                        broadcast ``C_i = Com_ck(c_i, t_i)``
     1.5              """
     1.6              # c_i = SUM_j Dec_sk_i(gamma_ij) - SUM_j d_ji mod p.
     1.7 -            dls = []
     1.8 -            for dij in dijs:
     1.9 -                dls.append(dij.value)
    1.10 -
    1.11 -            ls = [list(x) for x in zip(gammas, dls)]
    1.12 +            ls = [list(x) for x in zip(gammas, dijs)]
    1.13              ci = field(tripple_3a(ls, self.players[self.id].seckey))
    1.14              # (b) pick random t_i in (Z_p)^2.
    1.15              t1 = random_number(field.modulus)
    1.16 @@ -962,9 +958,9 @@
    1.17              p3 = field.modulus**3
    1.18              for pi in self.players.keys():
    1.19                  # choose random d_i,j in Z_p^3
    1.20 -                dij = random_number(p3)
    1.21 +                dij = random_number(p3).value
    1.22                  # gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij
    1.23 -                gammaij = tripple_2c(alphas[pi - 1], bj.value, dij.value, self.players[pi].pubkey)
    1.24 +                gammaij = tripple_2c(alphas[pi - 1], bj.value, dij, self.players[pi].pubkey)
    1.25                  # Broadcast gamma_ij
    1.26                  if pi != self.id:
    1.27                      self.protocols[pi].sendData(pc, PAILLIER, str(gammaij))
    1.28 @@ -1220,7 +1216,7 @@
    1.29                          raise OrlandiException("Inconsistent random value dij %i from player %i" % (dij, j + 1))
    1.30                      # gamma_ij = alpha_i^b_j Enc_ek_i(1;1)^d_ij
    1.31                      gammaij = tripple_2c(alphas[self.id - 1], bis[j][0].value, 
    1.32 -                                      dij.value, self.players[self.id].pubkey)
    1.33 +                                      dij, self.players[self.id].pubkey)
    1.34                      if gammaij != gammas[j]:
    1.35                          raise OrlandiException("Inconsistent gammaij, %i, %i" % (gammaij, gammas[j]))
    1.36  
    1.37 @@ -1249,13 +1245,13 @@
    1.38                          send_share(player_id, pc, b)
    1.39                          send_share(player_id, pc, c)
    1.40                          send_long(player_id, pc, alpha_randomness)
    1.41 -                        self.protocols[player_id].sendShare(pc, dijs[player_id - 1])
    1.42 +                        send_long(player_id, pc, dijs[player_id - 1])
    1.43  
    1.44                          ds_a[player_id - 1] = receive_shares(player_id)
    1.45                          ds_b[player_id - 1] = receive_shares(player_id)
    1.46                          ds_c[player_id - 1] = receive_shares(player_id)
    1.47                          ds_alpha_randomness[player_id - 1] = receive_long(player_id)
    1.48 -                        ds_dijs[player_id - 1] = self._expect_share(player_id, field)
    1.49 +                        ds_dijs[player_id - 1] = receive_long(player_id)
    1.50                  dls_a = gatherResults(ds_a)
    1.51                  dls_b = gatherResults(ds_b)
    1.52                  dls_c = gatherResults(ds_c)