alibaba-edu / mpc4j

Apache License 2.0
211 stars 42 forks source link

Source code of "Unbalanced Circuit-PSI from Oblivious Key-Value Retrieval" #33

Closed Th0masAndy closed 6 months ago

Th0masAndy commented 7 months ago

I've been reading the article recently and the paper mentions that the source code is in this repository, but it's not very clear for me to find out which part of the code corresponds to this paper. I'd appreciate some guidance and thank you in advance!

liuweiran900217 commented 7 months ago

The implementation of our paper "Unbalanced Circuit-PSI from Oblivious Key-Value Retrieval" is in https://github.com/alibaba-edu/mpc4j/tree/main/mpc4j-s2pc-pir/src/main/java/edu/alibaba/mpc4j/s2pc/upso/ucpsi.

I am sorry that the implementation is hidden in PIR. We have created a separate submodule, mpc4j-s2pc-upso, and moved all Unbalanced Private Set Operation (UPSO) implementations into it in the next preparing version (1.1.1).

However, note that we are still implementing many new protocols. We need more time to reorganize the source code for the next version. We will release it once we have done so.

Th0masAndy commented 7 months ago

Thank you so much for your help. But I only find PSTY19, CGS22 and SJ23 protocols in https://github.com/alibaba-edu/mpc4j/tree/main/mpc4j-s2pc-pir/src/main/java/edu/alibaba/mpc4j/s2pc/upso/ucpsi. I'm wondering about the implementation of this paper.

liuweiran900217 commented 7 months ago

In fact, PSTY19 in ucpsi is actually the implementations of our paper. We do not name our implementations as HLP+23 or something. The reason is that the core idea of our construction is to replace directly sending OKVS in PRTY19 to invoking OKVR (in other words, PIR), and we follow the original PSTY19 name as our name. The SJ23 is the baseline. CGS22 is another construction and it is correct, but we do not include it in our paper. In the next version, we will remove CGS22.

Th0masAndy commented 7 months ago

Okay I get it. Thank you very much for providing the source code and also implementing the other protocols.

Th0masAndy commented 7 months ago

Hi, I'm trying to study the experiment inside the paper, which mentions that the experiment was carried out with 8 threads. However, I only found the bool variable "parallel" in the source code to control the multithreading, and I didn't find the method to set the number of multithreading. I am running the experiment on my server and it will use all the 32 threads. I'm not familiar with JAVA and would appreciate your help!

liuweiran900217 commented 7 months ago

In our implementation, we use the common thread pool to manage multi-thread execution. The way of limiting the number of threads to 8 is just adding -Djava.util.concurrent.ForkJoinPool.common.parallelism=8 when running the jar, that is, java -Djava.util.concurrent.ForkJoinPool.common.parallelism=8 -Djava.library.path=/MPC4J/NATIVE/FHE/ABSOLUTE/PATH/cmake-build-release/:/MPC4J/NATIVE/TOOL/ABSOLUTE/PATH/cmake-build-release -jar YOUR_JAR_FILE.

By the way, do you plan to use mpc4j as your benchmark? If you also plan to implement your own work based on mpc4j, welcome to email me so that I may try to merge your work into mpc4j.

Th0masAndy commented 7 months ago

Thanks for your explanation. At the moment I am just studying the new technique "OKVR" in this paper and plan to test the performance of the protocol under different set sizes.