changeset 1498:9432d8d0d17e

BeDOZa: Renamed MessageList MACList.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Thu, 15 Jul 2010 11:37:33 +0200
parents eb00115f7755
children 24cee22d06bc
files viff/bedoza.py viff/bedoza_triple.py viff/test/test_bedoza_runtime.py viff/test/test_bedoza_triple.py
diffstat 4 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/viff/bedoza.py	Thu Jul 15 11:35:22 2010 +0200
+++ b/viff/bedoza.py	Thu Jul 15 11:37:33 2010 +0200
@@ -76,7 +76,7 @@
     def cmul(self, c):
         zi = c * self.value
         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))
+        zms = BeDOZaMACList(map(lambda m: c * m, self.macs.auth_codes))
         return BeDOZaShareContents(zi, zks, zms)
 
     def __str__(self):
@@ -139,7 +139,7 @@
     def __repr__(self):
         return str(self)
     
-class BeDOZaMessageList(object):
+class BeDOZaMACList(object):
 
     def __init__(self, auth_codes):
         self.auth_codes = auth_codes
@@ -155,14 +155,14 @@
         auth_codes = []
         for c1, c2 in zip(self.auth_codes, other.auth_codes):
             auth_codes.append(c1 + c2)
-        return BeDOZaMessageList(auth_codes)
+        return BeDOZaMACList(auth_codes)
 
     def __sub__(self, other):
         """Subtraction."""
         auth_codes = []
         for c1, c2 in zip(self.auth_codes, other.auth_codes):
             auth_codes.append(c1 - c2)
-        return BeDOZaMessageList(auth_codes)
+        return BeDOZaMACList(auth_codes)
 
     def __eq__(self, other):
         return self.auth_codes == other.auth_codes
@@ -198,7 +198,7 @@
         auth_codes = []
         for alpha, beta in keys:
             auth_codes.append(alpha * v + beta)
-        return BeDOZaMessageList(auth_codes)
+        return BeDOZaMACList(auth_codes)
 
     def generate_keys(self, field):
         alpha, betas = self.get_keys()
--- a/viff/bedoza_triple.py	Thu Jul 15 11:35:22 2010 +0200
+++ b/viff/bedoza_triple.py	Thu Jul 15 11:37:33 2010 +0200
@@ -26,7 +26,7 @@
 from viff.constants import TEXT
 from viff.util import rand
 
-from bedoza import BeDOZaKeyList, BeDOZaMessageList, BeDOZaShare
+from bedoza import BeDOZaKeyList, BeDOZaMACList, BeDOZaShare
 
 # TODO: Use secure random instead!
 from random import Random
@@ -263,7 +263,7 @@
         def finish_sharing(recevied_cs):
             mac_key_list = BeDOZaKeyList(self.alpha, mac_keys)
             decrypted_cs = [self.Zp(self.paillier.decrypt(c)) for c in received_cs.result]
-            mac_msg_list = BeDOZaMessageList(decrypted_cs)
+            mac_msg_list = BeDOZaMACList(decrypted_cs)
             # Twisted HACK: Need to pack share into tuple.
             return BeDOZaShare(self.runtime,
                                partial_shares[i].value.field,
--- a/viff/test/test_bedoza_runtime.py	Thu Jul 15 11:35:22 2010 +0200
+++ b/viff/test/test_bedoza_runtime.py	Thu Jul 15 11:37:33 2010 +0200
@@ -22,7 +22,7 @@
 from viff.test.util import RuntimeTestCase, protocol
 from viff.runtime import gather_shares, Share
 from viff.config import generate_configs
-from viff.bedoza import BeDOZaRuntime, BeDOZaShare, BeDOZaShareContents, BeDOZaKeyList, BeDOZaMessageList
+from viff.bedoza import BeDOZaRuntime, BeDOZaShare, BeDOZaShareContents, BeDOZaKeyList, BeDOZaMACList
 from viff.field import FieldElement, GF
 from viff.util import rand
 
@@ -40,8 +40,8 @@
 
         Zp = GF(6277101735386680763835789423176059013767194773182842284081)
 
-        m1 = BeDOZaMessageList([Zp(2), Zp(34)])
-        m2 = BeDOZaMessageList([Zp(11), Zp(4)])
+        m1 = BeDOZaMACList([Zp(2), Zp(34)])
+        m2 = BeDOZaMACList([Zp(11), Zp(4)])
         m3 = m1 + m2
         self.assertEquals(m3.auth_codes[0], 13)
         self.assertEquals(m3.auth_codes[1], 38)
@@ -80,12 +80,12 @@
 
         Zp = GF(6277101735386680763835789423176059013767194773182842284081)
        
-        x = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(3), Zp(4), Zp(1)]), BeDOZaMessageList([Zp(2), Zp(74), Zp(23), Zp(2)]))
-        y = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(5), Zp(2), Zp(7)]), BeDOZaMessageList([Zp(2), Zp(74), Zp(23), Zp(2)]))
+        x = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(3), Zp(4), Zp(1)]), BeDOZaMACList([Zp(2), Zp(74), Zp(23), Zp(2)]))
+        y = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(5), Zp(2), Zp(7)]), BeDOZaMACList([Zp(2), Zp(74), Zp(23), Zp(2)]))
         z = runtime._plus((x, y), Zp)
         self.assertEquals(z.get_value(), Zp(4))
         self.assertEquals(z.get_keys(), BeDOZaKeyList(Zp(23), [Zp(8), Zp(6), Zp(8)]))
-        self.assertEquals(z.get_macs(), BeDOZaMessageList([Zp(4), Zp(148), Zp(46), Zp(4)]))
+        self.assertEquals(z.get_macs(), BeDOZaMACList([Zp(4), Zp(148), Zp(46), Zp(4)]))
 
     @protocol
     def test_sum(self, runtime):
@@ -161,12 +161,12 @@
 
         Zp = GF(6277101735386680763835789423176059013767194773182842284081)
        
-        x = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(5), Zp(4), Zp(7)]), BeDOZaMessageList([Zp(2), Zp(75), Zp(23), Zp(2)]))
-        y = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(3), Zp(2), Zp(1)]), BeDOZaMessageList([Zp(2), Zp(74), Zp(23), Zp(2)]))
+        x = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(5), Zp(4), Zp(7)]), BeDOZaMACList([Zp(2), Zp(75), Zp(23), Zp(2)]))
+        y = BeDOZaShareContents(Zp(2), BeDOZaKeyList(Zp(23), [Zp(3), Zp(2), Zp(1)]), BeDOZaMACList([Zp(2), Zp(74), Zp(23), Zp(2)]))
         z = runtime._minus((x, y), Zp)
         self.assertEquals(z.get_value(), Zp(0))
         self.assertEquals(z.get_keys(), BeDOZaKeyList(Zp(23), [Zp(2), Zp(2), Zp(6)]))
-        self.assertEquals(z.get_macs(), BeDOZaMessageList([Zp(0), Zp(1), Zp(0), Zp(0)]))
+        self.assertEquals(z.get_macs(), BeDOZaMACList([Zp(0), Zp(1), Zp(0), Zp(0)]))
 
     @protocol
     def test_sub(self, runtime):
--- a/viff/test/test_bedoza_triple.py	Thu Jul 15 11:35:22 2010 +0200
+++ b/viff/test/test_bedoza_triple.py	Thu Jul 15 11:37:33 2010 +0200
@@ -27,7 +27,7 @@
 from viff.constants import TEXT
 from viff.runtime import gather_shares, Share
 from viff.config import generate_configs
-from viff.bedoza import BeDOZaRuntime, BeDOZaShare, BeDOZaKeyList, BeDOZaMessageList
+from viff.bedoza import BeDOZaRuntime, BeDOZaShare, BeDOZaKeyList
 
 from viff.bedoza_triple import TripleGenerator, PartialShare, PartialShareContents, ModifiedPaillier
 from viff.bedoza_triple import _send, _convolute, _convolute_gf_elm