google / rappor

RAPPOR: Privacy-Preserving Reporting Algorithms
Apache License 2.0
862 stars 163 forks source link

Python client limited to k<=32 #59

Open tkaitchuck opened 8 years ago

tkaitchuck commented 8 years ago

Attempting k=128 results in: File "../tests/rappor_sim.py", line 238, in main(sys.argv) File "../tests/rappor_sim.py", line 231, in main params1, params2, irr_rand, opts.assoc_testdata, csv_in, csv_out) File "../tests/rappor_sim.py", line 121, in GenAssocTestdata irr1 = stringencoder.encode(v1) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 335, in encode , _, irr = self._internal_encode(word) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 311, in _internal_encode prr, irr = self._internal_encode_bits(bloom) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 261, in _internal_encode_bits self.secret, to_big_endian(bits), self.params.prob_f, File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 162, in to_big_endian return struct.pack('>L', i)

trying with k=64 results in: Traceback (most recent call last): File "../tests/rappor_sim.py", line 238, in main(sys.argv) File "../tests/rappor_sim.py", line 231, in main params1, params2, irr_rand, opts.assoc_testdata, csv_in, csv_out) File "../tests/rappor_sim.py", line 121, in GenAssocTestdata irr1 = stringencoder.encode(v1) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 335, in encode , _, irr = self._internal_encode(word) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 311, in _internal_encode prr, irr = self._internal_encode_bits(bloom) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 262, in _internal_encode_bits self.params.num_bloombits) File "/usr/local/google/home/tkaitchuck/rappor2/rappor/client/python/rappor.py", line 201, in get_prr_masks raise RuntimeError('%d bits is more than the max of %d', num_bits, len(d)) NameError: global name 'd' is not defined

andychu commented 8 years ago

There are two limitations on k in Python:

1) fastrand module supporting 64 bits 2) PRR RNG is initialized with 32 bit value