changeset 1496:4892a9b5ceb7

BeDOZa: Added accessor method to KeyList.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Thu, 15 Jul 2010 11:35:21 +0200
parents 8a2f88e9f800
children eb00115f7755
files viff/bedoza.py
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/viff/bedoza.py	Thu Jul 15 11:35:20 2010 +0200
+++ b/viff/bedoza.py	Thu Jul 15 11:35:21 2010 +0200
@@ -61,18 +61,18 @@
     def add_public(self, c, my_id):
         if my_id == 1:
             self.value = self.value + c
-        self.keyList.keys[0] = self.keyList.keys[0] - self.keyList.alpha * c
+        self.keyList.get_keys()[0] = self.keyList.get_keys()[0] - self.keyList.alpha * c
         return self
     
     def sub_public(self, c, my_id):
         if my_id == 1:
             self.value = self.value - c
-        self.keyList.keys[0] = self.keyList.keys[0] + self.keyList.alpha * c
+        self.keyList.get_keys()[0] = self.keyList.get_keys()[0] + self.keyList.alpha * c
         return self
 
     def cmul(self, c):
         zi = c * self.value
-        zks = BeDOZaKeyList(self.keyList.alpha, map(lambda k: c * k, self.keyList.keys))
+        zks = BeDOZaKeyList(self.keyList.alpha, map(lambda k: c * k, self.keyList.get_keys()))
         zms = BeDOZaMessageList(map(lambda m: c * m, self.macs.auth_codes))
         return BeDOZaShareContents(zi, zks, zms)
 
@@ -108,6 +108,9 @@
         self.alpha = alpha
         self.keys = keys
 
+    def get_keys(self):
+        return self.keys
+
     def __add__(self, other):
         """Addition."""
         assert self.alpha == other.alpha
@@ -252,7 +255,7 @@
             values = num_shares * [0]
             isOK = num_shares * [True]
             for iny in xrange(num_shares):
-                keys = keyLists[iny].keys
+                keys = keyLists[iny].get_keys()
                 for inx, xs in enumerate(player_shares_codes):
                     xi, mi = xs[iny]
                     beta = keys[inx]
@@ -331,9 +334,9 @@
 
             n = len(self.players)
             alpha_a = keyList_a.alpha
-            keys_a = keyList_a.keys
+            keys_a = keyList_a.get_keys()
             alpha_b = keyList_b.alpha
-            keys_b = keyList_b.keys
+            keys_b = keyList_b.get_keys()
 
             a = 0
             b = 0
@@ -407,7 +410,7 @@
             isOK = True
             n = len(self.players)
             alpha = keyList.alpha
-            keys = keyList.keys
+            keys = keyList.get_keys()
             x = 0
             for inx in xrange(0, n):
                 xi = shares_codes[inx]