hashcloak / stoffelMPC

GNU Affero General Public License v3.0
38 stars 4 forks source link

Figure out strings within an MPC context #15

Open Mikerah opened 2 years ago

Mikerah commented 2 years ago

While designing the Stoffel language, I realized that from a developer perspective, having strings makes a lot of sense. For example, it can make conceptualizing how data is stored on the MPC nodes much easier. However, from an MPC perspective, strings are not so straightforward. You would need to use some form of oblivious data structure such as an oblivious array to hide a lot of information about the string such as its length, the contents and any indexing you want to do. Turns out this area of MPC is underexplored and even the ML/AI + MPC folks haven't figured it out as they are focused on making ML/AI + MPC work.

th4s commented 2 years ago

Conceptually a String (in Rust) is a Vec<u8>, meaning that it consists of three numbers

So you are right that we run into trouble, because the heap pointer is local to the machine/VM and probably not the same on other machines, so we cannot just secret-share these 3 numbers. But this question is nearly identical to how to treat dynamic arrays in stoffelMPC, so maybe we should think about how we attempt to solve that?

Mikerah commented 2 years ago

Well, a "simple" way to go about it is to store strings in oblivious arrays. However, that comes with a lot of overhead. Perhaps, a solution can be to have some syntactic sugar in the language to have strings for storage/identification purposes but they won't be a part of the MPC computation until we (or the MPC community) figures out a way to handle strings.