changeset 1463:d09cd2050333

comparison: Use integer exponentiation, not floating point.
author Marcel Keller <mkeller@cs.au.dk>
date Tue, 06 Jul 2010 15:21:05 +0200
parents 2ac4e8f3b3d0
children 6b96a1fdb751
files viff/comparison.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/comparison.py	Tue Jul 06 15:00:30 2010 +0200
+++ b/viff/comparison.py	Tue Jul 06 15:21:05 2010 +0200
@@ -156,7 +156,8 @@
 
     def convert_bit_share(self, share, dst_field):
         """Convert a 0/1 share into *dst_field*."""
-        l = self.options.security_parameter + math.log(dst_field.modulus, 2)
+        l = self.options.security_parameter + \
+            int(math.ceil(math.log(dst_field.modulus, 2)))
         # TODO assert field sizes are OK...
 
         this_mask = rand.randint(0, (2**l) -1)