MP-SPDZ icon indicating copy to clipboard operation
MP-SPDZ copied to clipboard

Using edaBits in low level C++ interface

Open nakkstar123 opened this issue 1 year ago • 3 comments

Hi,

Is there a way to use edaBits from the C++ low level interface? Utils/mixed-example.cpp has a MixedProtocolSetup which uses daBits but it's not clear how to use edaBits.

For example, how would I modify Utils/paper-example.cpp to use edaBits so that the operations are still performed using arithmetic shares but instead of opening in the last stage, parties output corresponding authenticated binary shares of the result (perhaps to feed this as input somewhere else, outside MP-SPDZ.)

Thanks in advance.

nakkstar123 avatar Sep 14 '24 19:09 nakkstar123

You can use preprocessing.get_edabit_no_count(strict, n_bits) to get edaBits. However, you will still need to implement the conversion using edaBits as this is done in the compiler when using the high-level interface.

mkskeller avatar Sep 18 '24 05:09 mkskeller

Thanks! Is there a way to obtain the compiled C++ file when using the high-level interface (if it is readable) so I can reference it to implement the conversion? Otherwise, can you point me to relevant source files that will help?

nakkstar123 avatar Sep 19 '24 02:09 nakkstar123

The high-level interface isn't compiled to C++ but to a specific instruction format. You can find an introduction in the documentation. For a specific program, you can use ./compile.py -a or Scripts/decompile.py to get the instructions in a human-readable format.

mkskeller avatar Sep 19 '24 02:09 mkskeller

You can now use the conversion in the compiler from C++ code: https://mp-spdz.readthedocs.io/en/latest/function-export.html

mkskeller avatar Nov 21 '24 07:11 mkskeller

This is super useful, thanks for the addition!

nakkstar123 avatar Nov 21 '24 07:11 nakkstar123