viff

changeset 1497:eb00115f7755

BeDOZa: Added accessor method to MessageList.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Thu, 15 Jul 2010 11:35:22 +0200
parents 4892a9b5ceb7
children 9432d8d0d17e
files viff/bedoza.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/viff/bedoza.py	Thu Jul 15 11:35:21 2010 +0200
     1.2 +++ b/viff/bedoza.py	Thu Jul 15 11:35:22 2010 +0200
     1.3 @@ -46,6 +46,9 @@
     1.4      def get_macs(self):
     1.5          return self.macs
     1.6  
     1.7 +    def get_mac(self, inx):
     1.8 +        return self.macs.get_mac(inx)
     1.9 +
    1.10      def __add__(self, other):
    1.11          zi = self.value + other.value
    1.12          zks = self.keyList + other.keyList
    1.13 @@ -141,6 +144,12 @@
    1.14      def __init__(self, auth_codes):
    1.15          self.auth_codes = auth_codes
    1.16  
    1.17 +    def get_macs(self):
    1.18 +        return self.auth_codes
    1.19 +
    1.20 +    def get_mac(self, inx):
    1.21 +        return self.auth_codes[inx]
    1.22 +        
    1.23      def __add__(self, other):
    1.24          """Addition."""
    1.25          auth_codes = []
    1.26 @@ -281,7 +290,7 @@
    1.27                  for inx, beDOZaContents in enumerate(ls):
    1.28                      keyLists.append(beDOZaContents.get_keys())
    1.29                      message_string += "%s:%s;" % \
    1.30 -                           (beDOZaContents.get_value().value, beDOZaContents.get_macs().auth_codes[other_id - 1].value)
    1.31 +                           (beDOZaContents.get_value().value, beDOZaContents.get_mac(other_id - 1).value)
    1.32                  self.protocols[other_id].sendData(pc, TEXT, message_string)
    1.33  
    1.34              if self.id in receivers:
    1.35 @@ -366,9 +375,9 @@
    1.36              pc = tuple(self.program_counter)
    1.37              for other_id in receivers:
    1.38                  self.protocols[other_id].sendShare(pc, a.get_value())
    1.39 -                self.protocols[other_id].sendShare(pc, a.get_macs().auth_codes[other_id - 1])
    1.40 +                self.protocols[other_id].sendShare(pc, a.get_mac(other_id - 1))
    1.41                  self.protocols[other_id].sendShare(pc, b.get_value())
    1.42 -                self.protocols[other_id].sendShare(pc, b.get_macs().auth_codes[other_id - 1])
    1.43 +                self.protocols[other_id].sendShare(pc, b.get_mac(other_id - 1))
    1.44                  
    1.45              if self.id in receivers:
    1.46                  num_players = len(self.players.keys())
    1.47 @@ -438,7 +447,7 @@
    1.48              pc = tuple(self.program_counter)
    1.49              for other_id in receivers:
    1.50                  self.protocols[other_id].sendShare(pc, shareContent.get_value())
    1.51 -                self.protocols[other_id].sendShare(pc, shareContent.get_macs().auth_codes[other_id - 1])
    1.52 +                self.protocols[other_id].sendShare(pc, shareContent.get_mac(other_id - 1))
    1.53              if self.id in receivers:
    1.54                  num_players = len(self.players.keys())
    1.55                  values = num_players * [None]