/rev/ba17bb67e477
changeset: 1286:ba17bb67e477
user: Janus Dam Nielsen <[email protected]>
date: Fri Oct 16 16:10:30 2009 +0200
summary: Merged with Martin.
diffstat:
viff/hash_broadcast.py | 5 ++-
viff/test/test_orlandi_runtime.py | 76 ++++++--------------------------------
2 files changed, 16 insertions(+), 65 deletions(-)
diffs (323 lines):
diff -r 225b81fa2d1d -r ba17bb67e477 viff/hash_broadcast.py
--- a/viff/hash_broadcast.py Fri Oct 16 15:59:06 2009 +0200
+++ b/viff/hash_broadcast.py Fri Oct 16 16:10:30 2009 +0200
@@ -19,7 +19,10 @@
from twisted.internet.defer import gatherResults, Deferred, DeferredList
-from hashlib import sha1
+try:
+ from hashlib import sha1
+except ImportError:
+ from sha import sha as sha1
from viff.constants import TEXT, INCONSISTENTHASH, OK, HASH, SIGNAL
error_msg = "Player %i, has received an inconsistent hash %s."
diff -r 225b81fa2d1d -r ba17bb67e477 viff/test/test_orlandi_runtime.py
--- a/viff/test/test_orlandi_runtime.py Fri Oct 16 15:59:06 2009 +0200
+++ b/viff/test/test_orlandi_runtime.py Fri Oct 16 16:10:30 2009 +0200
@@ -19,15 +19,19 @@
from viff.test.util import RuntimeTestCase, protocol, BinaryOperatorTestCase
from viff.runtime import Share, gather_shares
-from viff.orlandi import OrlandiRuntime, OrlandiShare
+try:
+ from viff.orlandi import OrlandiRuntime, OrlandiShare
+ import commitment
+except ImportError:
+ commitment = None
+ OrlandiRuntime = None
+ OrlandiShare = None
from viff.field import FieldElement, GF
from viff.passive import PassiveRuntime
from viff.util import rand
-# import commitment
-
def _get_triple(runtime, field):
n = field(0)
@@ -68,8 +72,6 @@
share.addCallback(check)
return share
- test_secret_share.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_open_secret_share(self, runtime):
"""Test sharing and open of a number."""
@@ -87,8 +89,6 @@
d.addCallback(check)
return d
- test_open_secret_share.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_random_share(self, runtime):
"""Test creation of a random shared number."""
@@ -103,8 +103,6 @@
d.addCallback(check)
return d
- test_random_share.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sum(self, runtime):
"""Test addition of two numbers."""
@@ -132,8 +130,6 @@
d.addCallback(check)
return d
- test_sum.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sum_plus(self, runtime):
"""Test addition of two numbers."""
@@ -161,8 +157,6 @@
d.addCallback(check)
return d
- test_sum_plus.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sum_constant(self, runtime):
"""Test addition of two numbers."""
@@ -185,8 +179,6 @@
d.addCallback(check)
return d
- test_sum_constant.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sub(self, runtime):
"""Test subtration of two numbers."""
@@ -214,8 +206,6 @@
d.addCallback(check)
return d
- test_sub.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sub_minus(self, runtime):
"""Test subtration of two numbers."""
@@ -243,8 +233,6 @@
d.addCallback(check)
return d
- test_sub_minus.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sub_constant(self, runtime):
"""Test subtration of two numbers."""
@@ -267,7 +255,6 @@
d.addCallback(check)
return d
- test_sub_constant.skip = "Commitment module is not included in VIFF."
class OrlandiAdvancedCommandsTest(RuntimeTestCase):
"""Test for advanced commands."""
@@ -293,8 +280,6 @@
d.addCallback(check)
return d
- test_shift.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_shift_two_inputters(self, runtime):
"""Test addition of the shift command."""
@@ -311,8 +296,6 @@
d2.addCallback(check)
return DeferredList([d1, d2])
- test_shift_two_inputters.skip = "Commitment module is not included in
VIFF."
-
@protocol
def test_shift_two_consequtive_inputters(self, runtime):
"""Test addition of the shift command."""
@@ -329,8 +312,6 @@
r.addCallback(r1)
return r
- test_shift_two_consequtive_inputters.skip = "Commitment module is not
included in VIFF."
-
@protocol
def test_shift_two_consequtive_inputters2(self, runtime):
"""Test addition of the shift command."""
@@ -350,8 +331,6 @@
r.addCallback(r1)
return r
- test_shift_two_consequtive_inputters2.skip = "Commitment module is not
included in VIFF."
-
@protocol
def test_input(self, runtime):
"""Test of many uses of the input command."""
@@ -374,8 +353,6 @@
shares_ready = gather_shares(a_shares + b_shares)
return shares_ready
- test_input.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_basic_multiply(self, runtime):
"""Test multiplication of two numbers."""
@@ -397,8 +374,6 @@
d.addCallback(check)
return d
- test_basic_multiply.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_mul_mul(self, runtime):
"""Test multiplication of two numbers."""
@@ -419,8 +394,6 @@
d.addCallback(check)
return d
- test_mul_mul.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_basic_multiply_constant_right(self, runtime):
"""Test multiplication of two numbers."""
@@ -441,8 +414,6 @@
d.addCallback(check)
return d
- test_basic_multiply_constant_right.skip = "Commitment module is not
included in VIFF."
-
@protocol
def test_basic_multiply_constant_left(self, runtime):
"""Test multiplication of two numbers."""
@@ -463,8 +434,6 @@
d.addCallback(check)
return d
- test_basic_multiply_constant_left.skip = "Commitment module is not
included in VIFF."
-
@protocol
def test_constant_multiplication_constant_left(self, runtime):
"""Test multiplication of two numbers."""
@@ -484,8 +453,6 @@
d.addCallback(check)
return d
- test_constant_multiplication_constant_left.skip = "Commitment module is
not included in VIFF."
-
@protocol
def test_constant_multiplication_constant_right(self, runtime):
"""Test multiplication of two numbers."""
@@ -505,8 +472,6 @@
d.addCallback(check)
return d
- test_constant_multiplication_constant_right.skip = "Commitment module is
not included in VIFF."
-
@protocol
def test_constant_multiplication_constant_None(self, runtime):
"""Test multiplication of two numbers."""
@@ -519,8 +484,6 @@
x2 = runtime.shift([1], self.Zp, x1)
y2 = runtime.shift([1], self.Zp, y1)
- test_constant_multiplication_constant_None.skip = "Commitment module is
not included in VIFF."
-
@protocol
def test_sum_poly(self, runtime):
"""Test implementation of sum_poly."""
@@ -539,8 +502,6 @@
self.assertEquals(Cx, 29)
return x
- test_sum_poly.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_sum_poly(self, runtime):
"""Test implementation of sum_poly."""
@@ -563,8 +524,6 @@
self.assertEquals(Cx, Cf1**3 * Cf2**9 * Cf3**27)
return x
- test_sum_poly.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_delta(self, runtime):
"""Test implementation of compute_delta."""
@@ -582,8 +541,6 @@
return delta
- test_delta.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_leak_mul(self, runtime):
"""Test leaktolerant multiplication of two numbers."""
@@ -616,11 +573,9 @@
self.assertEquals(z2, None)
return z2
- test_leak_mul.skip = "Commitment module is not included in VIFF."
-
class TripleGenTest(RuntimeTestCase):
"""Test for generation of triples."""
-
+
# Number of players.
num_players = 3
@@ -648,8 +603,6 @@
d.addCallbacks(open, runtime.error_handler)
return d
- test_tripleGen.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_tripleGen2(self, runtime):
"""Test the triple_gen command."""
@@ -676,8 +629,6 @@
d.addCallbacks(open, runtime.error_handler)
return d
- test_tripleGen2.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_tripleTest(self, runtime):
"""Test the triple_test command."""
@@ -698,8 +649,6 @@
d.addCallbacks(open, runtime.error_handler)
return d
- test_tripleTest.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_random_triple(self, runtime):
"""Test the triple_combiner command."""
@@ -730,8 +679,6 @@
d.addCallbacks(open, runtime.error_handler)
return d
- test_random_triple.skip = "Commitment module is not included in VIFF."
-
@protocol
def test_random_triple3_parallel(self, runtime):
"""Test the triple_combiner command."""
@@ -765,8 +712,6 @@
d.addCallbacks(open, runtime.error_handler)
return d
- test_random_triple3_parallel.skip = "Commitment module is not included in
VIFF."
-
@protocol
def test_random_triple_parallel(self, runtime):
"""Test the triple_combiner command."""
@@ -822,4 +767,7 @@
runtime.schedule_callback(shares_ready, cont)
return shares_ready
- test_random_triple_parallel.skip = "Commitment module is not included in
VIFF."
+if not commitment:
+ OrlandiAdvancedCommandsTest.skip = "Skipped due to missing commitment
module."
+ OrlandiBasicCommandsTest.skip = "Skipped due to missing commitment module."
+ TripleGenTest.skip = "Skipped due to missing commitment module."
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk