changeset 1031:85aad12606fb

New common input method for runtimes. The idea is that all runtimes should provide a method called "input". High-level code should call this method to provide input to the ideal functionality implemented by the runtime.
author Martin Geisler <mg@daimi.au.dk>
date Sun, 30 Nov 2008 17:31:02 +0100
parents b4f94a0d9a76
children 62fca9b7b777
files viff/paillier.py viff/passive.py
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/paillier.py	Fri Nov 28 10:20:55 2008 +0100
+++ b/viff/paillier.py	Sun Nov 30 17:31:02 2008 +0100
@@ -83,6 +83,13 @@
         share = field(prf(tuple(self.program_counter)))
         return Share(self, field, share)
 
+    def input(self, inputters, field, number=None):
+        """Input *number* to the computation.
+
+        The input is shared using the :meth:`share` method.
+        """
+        return self.share(inputters, field, number)
+
     @increment_pc
     def share(self, inputters, field, number=None):
         """Share *number* additively."""
--- a/viff/passive.py	Fri Nov 28 10:20:55 2008 +0100
+++ b/viff/passive.py	Sun Nov 30 17:31:02 2008 +0100
@@ -379,6 +379,13 @@
         # Use r_lsb to flip b as needed.
         return (b_p, b ^ r_lsb)
 
+    def input(self, inputters, field, number=None, threshold=None):
+        """Input *number* to the computation.
+
+        The input is shared using the :meth:`shamir_share` method.
+        """
+        return self.shamir_share(inputters, field, number, threshold)
+
     @increment_pc
     def shamir_share(self, inputters, field, number=None, threshold=None):
         """Secret share *number* over *field* using Shamir's method.