viff

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 diff
     1.1 --- a/viff/comparison.py	Tue Jul 06 15:00:30 2010 +0200
     1.2 +++ b/viff/comparison.py	Tue Jul 06 15:21:05 2010 +0200
     1.3 @@ -156,7 +156,8 @@
     1.4  
     1.5      def convert_bit_share(self, share, dst_field):
     1.6          """Convert a 0/1 share into *dst_field*."""
     1.7 -        l = self.options.security_parameter + math.log(dst_field.modulus, 2)
     1.8 +        l = self.options.security_parameter + \
     1.9 +            int(math.ceil(math.log(dst_field.modulus, 2)))
    1.10          # TODO assert field sizes are OK...
    1.11  
    1.12          this_mask = rand.randint(0, (2**l) -1)