[viff-devel] FW: Bug in ViFF

Martin Geisler mg at daimi.au.dk
Mon Oct 6 12:03:36 PDT 2008


Martin Geisler <mg at daimi.au.dk> writes:

> That would be a good idea, also for performance. I suggest that we use
> a round-robin system where we determine the perticipating subset based
> on the current program counter.

Code for this would look like this:

diff --git a/viff/runtime.py b/viff/runtime.py
--- a/viff/runtime.py
+++ b/viff/runtime.py
@@ -39,7 +39,7 @@
 from collections import deque
 
 from viff import shamir
-from viff.prss import prss, prss_lsb, prss_zero
+from viff.prss import prss, prss_lsb, prss_zero, generate_subsets
 from viff.field import GF256, FieldElement
 from viff.util import wrapper, rand
 
@@ -703,6 +703,18 @@
     def __init__(self, player, threshold, options=None):
         """Initialize runtime."""
         BasicRuntime.__init__(self, player, threshold, options)
+        self.subsets = {}
+
+    def select_subset(self, threshold):
+        """Select subset for *threshold* based on current program counter."""
+        try:
+            subsets = self.subsets[threshold]
+        except KeyError:
+            players = frozenset(range(1, self.num_players+1))
+            subsets = list(generate_subsets(players, 2*threshold + 1))
+            self.subsets[threshold] = subsets
+        return subsets[hash(tuple(self.program_counter)) % len(subsets)]
+

     @increment_pc
     def open(self, share, receivers=None, threshold=None):

(perhaps with an @increment_pc decorator...)

> So far I have a failing unit test which clearly shows the bug, I'll
> try and fix it now.

I've pushed the new unit tests as revision 4daa42544157, but I'm afraid
I'm too tired to fix things tonight... feel free to jump in :-)

-- 
Martin Geisler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20081006/eb8fb115/attachment.pgp>


More information about the viff-devel mailing list