/rev/c7403cb56ace
changeset: 1338:c7403cb56ace
user: Marcel Keller <[email protected]>
date: Tue Oct 27 19:25:33 2009 +0100
summary: active: Reasonable number of PRSS triples for big fields at a time.
diffstat:
viff/active.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (32 lines):
diff -r 568f9c696979 -r c7403cb56ace viff/active.py
--- a/viff/active.py Tue Oct 27 11:43:37 2009 +0100
+++ b/viff/active.py Tue Oct 27 19:25:33 2009 +0100
@@ -19,6 +19,8 @@
from math import ceil
+from gmpy import numdigits
+
from twisted.internet.defer import gatherResults, Deferred, succeed
from viff import shamir
@@ -419,7 +421,7 @@
result = self.generate_triples(field, quantity=1, gather=False)
return result[0]
- def generate_triples(self, field, quantity=20, gather=True):
+ def generate_triples(self, field, quantity=1, gather=True):
"""Generate *quantity* multiplication triples using PRSS.
These are random numbers *a*, *b*, and *c* such that ``c =
@@ -428,7 +430,9 @@
Returns a tuple with the number of triples generated and a
Deferred which will yield a singleton-list with a 3-tuple.
"""
- quantity = min(quantity, 20)
+
+ # This adjusted to the PRF based on SHA1 (160 bits).
+ quantity = min(quantity, max(int(160 /numdigits(field.modulus - 1,
2)), 1))
a_t = self.prss_share_random_multi(field, quantity)
b_t = self.prss_share_random_multi(field, quantity)
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk