viff

changeset 751:5dd8c277268c

Switch to prss_share_bit_double in comparisons.
author Martin Geisler <mg@daimi.au.dk>
date Tue, 13 May 2008 16:28:41 +0200
parents b0bf45ad7dda
children 3b216d67f51d
files viff/comparison.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/viff/comparison.py	Tue May 13 16:09:07 2008 +0200
     1.2 +++ b/viff/comparison.py	Tue May 13 16:28:41 2008 +0200
     1.3 @@ -74,20 +74,19 @@
     1.4          assert 2**(l+1) + 2**t < field.modulus, "2^(l+1) + 2^t < p must hold"
     1.5          assert self.num_players + 2 < 2**l
     1.6  
     1.7 -        int_bits = [self.prss_share_random(field, True) for _ in range(m)]
     1.8 +        bits = [self.prss_share_bit_double(field) for _ in range(m)]
     1.9 +
    1.10 +        int_bits = [a for (a, _) in bits]
    1.11 +        bit_bits = [b for (_, b) in bits]
    1.12 +
    1.13          # We must use int_bits without adding callbacks to the bits --
    1.14          # having int_b wait on them ensures this.
    1.15 -
    1.16          def bits_to_int(bits):
    1.17              """Converts a list of bits to an integer."""
    1.18              return sum([2**i * b for i, b in enumerate(bits)])
    1.19  
    1.20          int_b = gather_shares(int_bits)
    1.21          int_b.addCallback(bits_to_int)
    1.22 -
    1.23 -        # TODO: this changes int_bits! It should be okay since
    1.24 -        # int_bits is not used any further, but still...
    1.25 -        bit_bits = [self.convert_bit_share(b, GF256) for b in int_bits]
    1.26          # Preprocessing done
    1.27  
    1.28          a = share_a - share_b + 2**l