changeset 1035:f7d1f7cd3dda

Enable faking of Shamir secret sharing.
author Martin Geisler <mg@daimi.au.dk>
date Sun, 30 Nov 2008 23:13:26 +0100
parents 1a9cfb730bc1
children d47b8da68a23
files viff/shamir.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/shamir.py	Sun Nov 30 23:13:12 2008 +0100
+++ b/viff/shamir.py	Sun Nov 30 23:13:26 2008 +0100
@@ -24,9 +24,10 @@
 
 
 import operator
-from viff.util import rand
+from viff.util import rand, fake
 
 
+@fake(lambda s, t, n: [(s.field(i+1), s) for i in range(n)])
 def share(secret, threshold, num_players):
     """Shamir share secret.
 
@@ -92,6 +93,7 @@
 _recombination_vectors = {}
 
 
+@fake(lambda s, x=0: s[0][1])
 def recombine(shares, x_recomb=0):
     """Recombines list of ``(xi, yi)`` pairs.