http://hg.viff.dk/viff/rev/476bac16b2d9
changeset: 1059:476bac16b2d9
user:      Martin Geisler <[email protected]>
date:      Tue Dec 16 13:21:27 2008 +0100
summary:   Added abstract methods to Runtime.
The idea is that all classes inheriting from Runtime should define
input, output, add, and mul methods with the interface from Runtime.

diffstat:

1 file changed, 35 insertions(+)
viff/runtime.py |   35 +++++++++++++++++++++++++++++++++++

diffs (45 lines):

diff -r 806148d6146f -r 476bac16b2d9 viff/runtime.py
--- a/viff/runtime.py   Tue Dec 16 13:21:22 2008 +0100
+++ b/viff/runtime.py   Tue Dec 16 13:21:27 2008 +0100
@@ -680,6 +680,41 @@
             wait_list.append(ready)
         return DeferredList(wait_list)
 
+    def input(self, inputters, field, number=None):
+        """Input *number* to the computation.
+
+        The players listed in *inputters* must provide an input
+        number, everybody will receive a list with :class:`Share`
+        objects, one from each *inputter*. If only a single player is
+        listed in *inputters*, then a :class:`Share` is given back
+        directly.
+        """
+        raise NotImplemented("Override this abstract method in a subclass.")
+
+    def output(self, share, receivers=None):
+        """Open *share* to *receivers* (defaults to all players).
+
+        Returns a :class:`Share` to players with IDs in *receivers*
+        and :const:`None` to the remaining players.
+        """
+        raise NotImplemented("Override this abstract method in a subclass.")
+
+    def add(self, share_a, share_b):
+        """Secure addition.
+        
+        At least one of the arguments must be a :class:`Share`, the
+        other can be a :class:`FieldElement` or a (possible long)
+        Python integer."""
+        raise NotImplemented("Override this abstract method in a subclass.")
+
+    def mul(self, share_a, share_b):
+        """Secure multiplication.
+        
+        At least one of the arguments must be a :class:`Share`, the
+        other can be a :class:`FieldElement` or a (possible long)
+        Python integer."""
+        raise NotImplemented("Override this abstract method in a subclass.")
+
 
 def make_runtime_class(runtime_class=None, mixins=None):
     """Creates a new runtime class with *runtime_class* as a base
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk

Reply via email to