mpc4j/PAPERS.md
Keyword PIR and Unbalanced PSI
We implement Keyword PIR (also known as Labeled PSI) in mpc4j-s2pc-pir
and unbalanced PSI in mpc4j-s2pc-pso
. Here we list other labeled PSI papers, e.g., schemes proposed in CCS 2018 and CCS 2017. We do not implement them since the scheme in CCS 2021 is strictly more efficient than others. We note that we learned a lot from their original implementations. See APSI and 6857-private-categorization for more details.
标签pir是在mpc4j-s2pc-pir中实现的
这个项目包入口函数
PirMain
1 修改配置conf文件 mpc4j-main\mpc4j-s2pc-pir\conf\cppir\conf_cpkspir_client.conf
cppir是Client-preprocessing PIR客户端预处理
Extremely Simple, Single-Server PIR with Sublinear Server Computation. S&P 2024.
Simple and Practical Amortized Sublinear Private Information Retrieval. Cryptology ePrint Archive (2023).
index_pir是Index PIR
# task type
task_type = KEYWORD_PIR_TASK
# log(n)
server_log_set_size = 20,22,24
# element bit length
element_bit_length = 128
# query num
query_number = 1000
# protocol name
pto_name = CMG21
根据对应实现要修改配置文件
for (int i = 0; i < queryNum; i++) { server.pir(); }
这个模块的Keyword有三个算法
CMG21:https://eprint.iacr.org/2021/1116
AAAG22:https://eprint.iacr.org/2023/1331.pdf
ALPR21:https://www.usenix.org/system/files/sec21-ali.pdf
APSI中的算法对应的CMG21
和之前的一篇分析的流程是一样的,入口函数,server,client,重点计算方法,这里增加了重点参数的调整
数据预处理
热身数据:server数据量 2^10=1024
查询数据量 2^5=32
会根据单元长度生成随机数
服务端数据生成
server_log_set_size = 20,22,24 依然是2的幂次值 element_bit_length = 128 单元位长度 这里数据生成的逻辑都是一样的有3个幂值就生成3个数据文件
服务端server
runServer函数 主要的执行逻辑:
- 通过
KwPirFactory.createServer
方法创建了一个KwPirServer
对象,用于处理 PIR(Private Information Retrieval)任务。 - 使用
init
方法初始化了服务器,传入了关键字值映射keywordValueMap
,1(代表什么?)以及字节长度byteL
。 - 使用循环执行了
queryNum
次的 PIR 操作,即通过pir
方法执行了 PIR 查询。 - 最后统计了初始化和执行 PIR 任务的时间,以及相关的数据包数量和字节长度,并将这些信息输出到
printWriter
对象中。
测试实验
1 预编译文件
mpc4j-native-fhe、mpc4j-native-tool
2 服务端命令行
java -Djava.library.path=/home/fourQTest/mpc4j-native-tool/cmake-build-release:/home/fourQTest/mpc4j-native-fhe/cmake-build-release -jar mpc4j-s2pc-pir-1.1.0-jar-with-dependencies.jar conf_cpkspir_server.conf
3 客户端命令行
java -Djava.library.path=/home/fourQTest/mpc4j-native-tool/cmake-build-release:/home/fourQTest/mpc4j-native-fhe/cmake-build-release -jar mpc4j-s2pc-pir-1.1.0-jar-with-dependencies.jar conf_cpkspir_client.conf
4 测试结果
1)查询数量1000,100W 62.0955667分钟 1小时也太漫长了。。。。
element_byte_length = 128
query_number = 1000
PartyID ServerSetSize QueryNumber IsParallel ThreadNum InitTime(ms) InitDataPacketNum InitPayload Bytes(B) InitSendBytes(B) PtoTime(ms) PtoDataPacketNum PtoPayloadBytes(B) PtoSendBytes(B)
0 1048576 1000 true 47 20778 1 16 32 3725667 3000 1967807000 1967929619
PartyID ServerSetSize QueryNumber IsParallel ThreadNum InitTime(ms) InitDataPacketNum InitPayload Bytes(B) InitSendBytes(B) PtoTime(ms) PtoDataPacketNum PtoPayloadBytes(B) PtoSendBytes(B) Memory
1 1048576 1000 true 47 8942 1 590470 590496 3725734 2000 1050160000 1050233746 9007464 (1.96GB)
2)查询数量是2
element_byte_length = 16
query_number = 2
查询数量是2,根据查询数量去做2次pir交互
PartyID ServerSetSize QueryNumber IsParallel ThreadNum InitTime(ms) InitDataPacketNum InitPayload Bytes(B) InitSendBytes(B) PtoTime(ms) PtoDataPacketNum PtoPayloadBytes(B) PtoSendBytes(B)
0 1048576 2 true 47 19465 1 16 32 7058 6 2623764 2623964
0 4194304 2 true 47 67101 1 16 32 7196 6 2230096 2230280
0 16777216 2 true 47 240908 1 16 32 7552 6 6428016 6428328
PartyID ServerSetSize QueryNumber IsParallel ThreadNum InitTime(ms) InitDataPacketNum InitPayload Bytes(B) InitSendBytes(B) PtoTime(ms) PtoDataPacketNum PtoPayloadBytes(B) PtoSendBytes(B) Memory
1 1048576 2 true 47 8668 1 590470 590496 7127 4 2100320 2100464 9006960
1 4194304 2 true 47 33659 1 1049416 1049442 7281 4 1968084 1968204 9663264
1 16777216 2 true 47 143760 1 1049416 1049442 7657 4 1968084 1968204 9616128
3)查询数量是1000
element_byte_length = 16
query_number = 1000
Party ID Server Set Size Query Number Is Parallel Thread Num Init Time(ms) Init DataPacket Num Init Payload Bytes(B) Init Send Bytes(B) Pto Time(ms) Pto DataPacket Num Pto Payload Bytes(B) Pto Send Bytes(B)
0 1048576 1000 true 47 17863 1 16 32 3637624 3000 1311882000 1311984619
0 4194304 1000 true 47 61196 1 16 32 3584977 3000 1115048000 1115142619
0 16777216 1000 true 47 214460 1 16 32 3814966 3000 3214008000 3214166619
Party ID Server Set Size Query Number Is Parallel Thread Num Init Time(ms) Init DataPacket Num Init Payload Bytes(B) Init Send Bytes(B) Pto Time(ms) Pto DataPacket Num Pto Payload Bytes(B) Pto Send Bytes(B) Memory
1 1048576 1000 true 47 8020 1 590470 590496 3637695 2000 1050160000 1050233746 9008552
1 4194304 1000 true 47 32936 1 1049416 1049442 3585085 2000 984042000 984103746 9698688
1 16777216 1000 true 47 136100 1 1049416 1049442 3815086 2000 984042000 984103746 9633880