bristolcrypto/SPDZ-2

readable result

destinyzju opened this issue · 1 comments

Hi there,

Take the following program for example:
a = sint.get_raw_input_from(0)
b = sint.get_raw_input_from(1)
c = a + b
print_ln('Result is %s', c.reveal())
c.reveal_to(0)

While in the terminal the result is readable, the data in the Private-Output-Data-0 is in some binary form and not readable. Is there a way or internal method output a readable result to the Private-Output-Data-0 file?

Thanks,
Jing

You can look at how private input is generated ("Scripts/gen_input_fp.cpp") and do the same to generate the output.

Something like that...

...
    ifstream cin("gfp_output_vals.in");
    ofstream cout("gfp_output_vals.out");

    gfp::init_field(bigint("172035116406933162231178957667602464769"));
    gfp b;

    while (!(cin.peek() == EOF)) {
        b.input(cin, false);
        b.output(cout, true);
        cout << "\n";
    }
...