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 wrap: on
line diff
--- a/viff/bedoza.py	Thu Jul 15 11:35:21 2010 +0200
+++ b/viff/bedoza.py	Thu Jul 15 11:35:22 2010 +0200
@@ -46,6 +46,9 @@
     def get_macs(self):
         return self.macs
 
+    def get_mac(self, inx):
+        return self.macs.get_mac(inx)
+
     def __add__(self, other):
         zi = self.value + other.value
         zks = self.keyList + other.keyList
@@ -141,6 +144,12 @@
     def __init__(self, auth_codes):
         self.auth_codes = auth_codes
 
+    def get_macs(self):
+        return self.auth_codes
+
+    def get_mac(self, inx):
+        return self.auth_codes[inx]
+        
     def __add__(self, other):
         """Addition."""
         auth_codes = []
@@ -281,7 +290,7 @@
                 for inx, beDOZaContents in enumerate(ls):
                     keyLists.append(beDOZaContents.get_keys())
                     message_string += "%s:%s;" % \
-                           (beDOZaContents.get_value().value, beDOZaContents.get_macs().auth_codes[other_id - 1].value)
+                           (beDOZaContents.get_value().value, beDOZaContents.get_mac(other_id - 1).value)
                 self.protocols[other_id].sendData(pc, TEXT, message_string)
 
             if self.id in receivers:
@@ -366,9 +375,9 @@
             pc = tuple(self.program_counter)
             for other_id in receivers:
                 self.protocols[other_id].sendShare(pc, a.get_value())
-                self.protocols[other_id].sendShare(pc, a.get_macs().auth_codes[other_id - 1])
+                self.protocols[other_id].sendShare(pc, a.get_mac(other_id - 1))
                 self.protocols[other_id].sendShare(pc, b.get_value())
-                self.protocols[other_id].sendShare(pc, b.get_macs().auth_codes[other_id - 1])
+                self.protocols[other_id].sendShare(pc, b.get_mac(other_id - 1))
                 
             if self.id in receivers:
                 num_players = len(self.players.keys())
@@ -438,7 +447,7 @@
             pc = tuple(self.program_counter)
             for other_id in receivers:
                 self.protocols[other_id].sendShare(pc, shareContent.get_value())
-                self.protocols[other_id].sendShare(pc, shareContent.get_macs().auth_codes[other_id - 1])
+                self.protocols[other_id].sendShare(pc, shareContent.get_mac(other_id - 1))
             if self.id in receivers:
                 num_players = len(self.players.keys())
                 values = num_players * [None]