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

Using Dictionaries as a data structure

Open shreyansh26 opened this issue 5 years ago • 11 comments

I wanted to know if there exists a way to use dictionaries in the .mpc format files like the Matrix and Array ones.

shreyansh26 avatar Sep 05 '19 13:09 shreyansh26

Unfortunately not. The virtual machine currently supports neither the dynamic memory allocation needed for a tree-based or a hash-based map.

mkskeller avatar Sep 10 '19 10:09 mkskeller

Right, however, I see that when I use normal dictionaries like in Python, the code still does compile and run. So, how does that work then?

shreyansh26 avatar Sep 11 '19 07:09 shreyansh26

The Python code is executed at compile time. So you can always use Python dictionaries, but if you use e.g. regint objects as dictionary index, you might not get the result you expect.

mkskeller avatar Sep 11 '19 07:09 mkskeller

Okay, thank you. I guess I'll have to play around with it a bit more.

shreyansh26 avatar Sep 11 '19 07:09 shreyansh26

Is the 'limitation' of the virtual machine to non-dynamic memory allocation based on some basic theoretical limitations or could it in principle be extended? Is there any documentation regarding the virtual machine implementation (other than reading the code)?

chrisZgh avatar Dec 02 '19 10:12 chrisZgh

The only theoretical limitation is that memory accesses by secret addresses are rather expensive because that requires oblivious RAM. For the rest, there is no theoretical limitation, it is simply not a priority at this stage.

Regarding documentation of the VM, all instructions for arithmetic computation are defined in Compiler/instruction.py, and most of them come with a brief doc-string, but that's about it at the moment.

mkskeller avatar Dec 02 '19 10:12 mkskeller

Ok, thank you for the information. I had a closer look at several source code parts. Is there an open source implementation including oblivious RAM? I also had a look into SCALE-MAMBA which also does not have it as far as I understood.

chrisZgh avatar Dec 05 '19 16:12 chrisZgh

The oblivious RAM is implemented in Compiler/oram.py and Compiler/path_oram.py with applications in Compiler/dijkstra.py and Compiler/gs.py. This code is also available in SCALE-MAMBA because it stems from the predecessor project.

mkskeller avatar Dec 05 '19 21:12 mkskeller

Ok thanks.

chrisZgh avatar Dec 08 '19 07:12 chrisZgh

What's the status of this? It appears to me that MP-SPDZ in its current state can be used to implement an oblivious dictionary as described in https://eprint.iacr.org/2014/137.pdf.

Mikerah avatar Oct 11 '22 15:10 Mikerah

Only partially because the keys have to fixed-length for the solution in said paper. I think the original question was also more geared towards public keys by referring to Array and Matrix, which only work with public indices.

mkskeller avatar Oct 12 '22 03:10 mkskeller