data61 / MP-SPDZ

Versatile framework for multi-party computation
Other
944 stars 280 forks source link

Shuffling array of binary values #1505

Closed mcocartsy closed 1 month ago

mcocartsy commented 1 month ago

Hi, I'm trying to create an array and shuffle it with the following code:

n = 10
if len(program.args) > 1:
    n = int(program.args[1])
list_indexes = [sint(i) for i in range(n)]
indexes = Array(n, sint).create_from(list_indexes)
indexes.secure_shuffle()

But running as follows:

../MP-SPDZ/Scripts/compile-run.py -v -E yao -B 64 test 10

Returns the following error:

  File "/root/benchmarks/../MP-SPDZ/Scripts/compile-run.py", line 14, in <module>
    prog = compiler.compile_file()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/benchmarks/../MP-SPDZ/Scripts/../Compiler/compilerLib.py", line 472, in compile_file
    exec(compile(infile.read(), infile.name, "exec"), self.VARS)
  File "Programs/Source/test.mpc", line 65, in <module>
    indexes.secure_shuffle()
  File "/root/benchmarks/../MP-SPDZ/Scripts/../Compiler/types.py", line 6327, in secure_shuffle
    self.assign_vector(self.get_vector().secure_shuffle())
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'sbitvecn' object has no attribute 'secure_shuffle'

I think the problem is that I'm using binary values, because -E ring -R 64 works. So is there an alternative to create a random array for Yao? Thank you.

mkskeller commented 1 month ago

This hasn't been implemented.

mcocartsy commented 1 month ago

Thanks!