lschoe / mpyc

MPyC: Multiparty Computation in Python
MIT License
367 stars 76 forks source link

Questions about using the Shamir secret sharing protocol #91

Closed sda427 closed 3 months ago

sda427 commented 3 months ago
  1. Does MPyC support direct input secret sharing? Our own program has already generated secret shares through shamir protocol, and we want to use MPyC for subsequent secure multi-party computation based on shamir protocol, which does not seem to be described in the documentation.
  2. Does MPyC support the definition of a variable length data structure in ciphertext?
lschoe commented 3 months ago

The answer to your first question is "yes". For example, if you have say three parties holding secret shares of a secure integer, you can assign these shares locally, for each party, and then they can continue to do secure computation with the resulting secure integer.

Party 0 executes a = secint(secint.field(12723956914977493523)) in its program. Party 1 executes a = secint(secint.field(7001169756245412185)) in its program. Party 2 executes a = secint(secint.field(1278382597513330847)) in its program.

Then if they run print(await mpc.output(a)) they should all see 23434 being printed.

About your second question, not sure what it is about?

sda427 commented 3 months ago

Thank you very much for your answer.

The second question is about secure types. When I use secint.array to define a secure array, is there a way to define a variable-length array without specifying the array length? For example, T = secint.array().

lschoe commented 3 months ago

Well, no, Numpy arrays are not variable length. And all entries of a Numpy array are of the same type. This allows for efficient processing, in a vectorized manner. Using lists you can have variable length and elements of mixed type, but that usually incurs some extra costs.