Giter VIP home page Giter VIP logo

mpc4j's People

Contributors

alibaba-oss avatar liuweiran900217 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpc4j's Issues

can't complie the SEAL

Hi, I created a ubuntu: 20.04 container in Docker.
I encountered this problem when executing "make". What can I do to solve it?

图片
图片

Question about KeyWordPir

Hello!
I would like to know if you could tell me how the indistinguishable degree in the keywordPir(cmg21) is calculated specifically,
and how to choose the Cmg21KwPirParams If the server has 100 million data and the client has 100 queries。
Thank you!

关于OSN洗牌算法的两个问题。

刘老师,我想向您请教两个关于OSN洗牌算法的问题。
第一个问题是OSN是否能将输出调整为算术电路上的秘密分享?
第二个问题是假设OSN的输出可以调整为算术秘密分享,当输入向量中的每个元素不是一个值,而是由n个算术秘密分享组成的数组,这种情况下如何洗牌是最优解?我自己想了两个方案,一是调用2n次OSN算法进行洗牌;二是将n个值级联起来,然后调用2次OSN算法进行洗牌,但是需要在洗牌前进行A2B并且在洗牌后进行B2A。然而前者会导致OSN复杂度中与比特长度无关的固定项累加2n-2次,后者需要的两次转换成本也非常高。

感谢您的指导!

java.lang.UnsatisfiedLinkError: no mpc4j-native-tool in java.library.path

咨询下,mpc4j-native-tool在centos7.6环境编译生成的cmake-build-release文件夹可以在Windows上IntelliJ IDEA进行使用么?参考了https://github.com/alibaba-edu/mpc4j说明中Demonstration部分的第8点进行配置,即在VM进行配置-Djava.library.path=我放路径,结果会报错,如图:
image
编译后路径如图:
image
在IntelliJ IDEA上如何才能运行mpc4j-native-tool与mpc4j-native-fhe编译后cmake-build-release

Some issues with building and running mpc4j according to the demonstration you provided.

  1. Why I haven't got "libmpc4j-native-tool.dylib" and "libmpc4j-native-fhe.dylib" under “mpc4j/mpc4j-native-tool”?I successfully compiled them and saw the following output ”[100%] Built target mc4j-native-tool“ . But I'm not sure if I saw "[100%] Linking CXX shared library libmpc4j-native-tool.dylib".
    image
  2. After setting "VM Options", I can't apply it.
    image
    So I clicked "OK" then got nothing here.
    image
    And no Green Arrows showing on the left.
    image
    I tried to run but got problems.
    image
    By the way, my system is ubuntu18.04.

Any help or suggest means a lot to me. Thanks!

An error with NTL in ubuntu docker

When I want to install NTL in Docker on Unbuntu 20.04 ,
this step : ./configure SHARED=on CXXFLAGS=-O3 ,cause an error: permission denied。If I don't use "SHARED=on",this problem will not happen 。I have tried "sudo" "su root" "chmod +x configure" "chmod 777 configure" etc,but nothing could help。
I wonder whether if you have some good ideas about this problem.Thank you!

Empty private constructors

I have noticed that many classes have // empty inside the private constructor, which I assume is the way to instantiate those classes. Is it todo work? Many tests do not work for me with errors like: "could not initialize class X..."

支持分布式使用吗

如果数据量过大,比如隐私计算求交,求并这类计算,数据量较大,是否支持分布式部署使用,有相关示例吗

开发测试遇到Party state must not be NON_INITIALIZED

您好!我刚安装了这个库,想在上面组合不同组件实现一个协议,但是我对框架构造和java语言都不熟悉。我目前仿着其他协议,添加了一个初步的协议,在init函数里先是运行了一个子协议的init函数,在功能函数里也是先运行了子协议的功能,还没有组合其他组件。
但是,我在添加了测试后,INIT阶段就遇到了如下报错信息:
Exception in thread "Thread-1" java.lang.IllegalStateException: Party state must not be NON_INITIALIZED
Exception in thread "Thread-0" java.lang.IllegalStateException: Party state must not be NON_INITIALIZED
2024-06-24 13:39:43,153 [main] INFO edu.alibaba.mpc4j.common.rpc.impl.memory.MemoryRpc - P_1 (ID = 0) disconnected
2024-06-24 13:39:43,153 [main] INFO edu.alibaba.mpc4j.common.rpc.impl.memory.MemoryRpc - P_2 (ID = 1) disconnected
请问您们这个问题出在哪里?

关于batch-index-pir性能的疑问

我想使用mpc4j框架复现的“Vectorized Batch Private Information Retrieval”论文进行性能测试。对于论文中给出的性能数据,
image,我使用如下测试代码(https://github.com/alibaba-edu/mpc4j/blob/v1.0.8/mpc4j-s2pc-pir/src/test/java/edu/alibaba/mpc4j/s2pc/pir/batchpir/BatchPirTest.java#L112),给定参数为gc.testPto(1000000, 16, 288, false)(这里应该是288比特?如果设置288字节的话我的机器内存会爆掉),得到如下实验数据
image
我的实验环境是Intel(R) Xeon(R) Silver 4210R CPU @ 2.40GHz,40核,64GB内存。请问为什么我的结果与论文中的数据偏差很大,或许论文中的Computation结果只统计了server.pir阶段中的某一部分?或许是我们的机器性能相差很大?以及mpc4j中的elementBitLength是代表比特数吗?

keyword PIR中的value取值问题

keyword-pir的功能里面查询返回的key-value Map的value是固定长度的,而实际应用中这个value的长度是无法预估和保证固定长度的。 这种场景要怎么支持或改造呢?

Begginer question for project compilation and usage inside another project

Hi, I'm very interested in using this cool project within another one. I'm very begginer for project compilation tools and I would like to ask for a recommendation on how to achieve what I want.

Basically, I want to embed mpc4j inside another java project, more specifically a multiproject built with gradle. My structure would be:

JavaSrcProject
|----Subproject1
|----Subproject2
|----mpc4j

My intention is to leave Subproject2 as a wrapper for JavaSrcProject to interact with mpc4j. I am trying to include mpc4j as a dependency for Subproject2, using:
dependencies { implementation files(/local/path/to/jar) }

However, I am struggling with mpc4j-native dependencies, because I don't know how to include them as well.

Any suggestions or clarifications would be greatly appreciated.
Thanks in advance.

关于计算内存的疑问

YV UZOG%FW{~E1}%J4O2R(S
以计算psi为例,关于数据输入,如果计算两方数据求交,那两个set需要放入两方的全量数据,如果读取数据量过大,比如100g大小文件,两方就是200g,如果计算节点内存较小64g,该如何使用psi求交

关于OKVS、VODM、OVDM

刘大佬您好,想请教下以下问题:

  1. 在论文Linear Private Set Union from Multi-Query Reverse Private Membership Test(ZCL22)中,前文提到的VODM与后文中的OVDM应该是一个意思?
  2. 在SKE-PSU中,用到的OVDM指向了这个实现,但里面的注释说OVDM由VOLE-PSI中提出定义,但这篇文章看起来是一个OKVS、OPPRF的方案。
    * GF(2^l)不经意映射值解密匹配(Oblivious Value Decryption Matching,OVDM)。最开始的定义来自于:
    * Rindal P, Schoppmann P. VOLE-PSI: Fast OPRF and Circuit-PSI from Vector-OLE. EUROCRYPT 2021.
    * Springer, Cham, pp. 901-930.

    3.ZCL22中,说到SKE的VODM是由GMW协议构造的,但没有给出具体的构造方法,想知道是GMW结合SKE实现了部分功能,还是整个protocol转换成一个多方计算?这里我没太想明白是怎么做的

mpc4j-s2pc-pir 输入数据elementBitLength问题

在实验数据中,生成的每行数据长度是固定的,因此在开始server端初始化的时候是知道elementBitLength长度的,如果每行实验数据的长度是未知的,elementBitLength在输入的时候不能确定初始化的时候要怎么办?初始化第三步进行多项式计算的时候涉及
int labelPartitionCount = CommonUtils.getUnitNum((labelByteLength + ivByteLength) * Byte.SIZE,
(PirUtils.getBitLength(params.getPlainModulus()) - 1) * itemEncodedSlotSize);
还有就是服务端和客户端的数据 Key和Label的大小是不是都要小于128bit

Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: Run s2pc-aby SingleZ2cTest

您好,

我在学习您们团队的mpc4j代码,在运行s2pc-aby中的SingleZ2cTest 时,出现如下错误

Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: 'byte[] edu.alibaba.mpc4j.common.tool.crypto.ecc.fourq.FourqByteFullEcc.nativeMul(byte[], byte[])'
at edu.alibaba.mpc4j.common.tool.crypto.ecc.fourq.FourqByteFullEcc.nativeMul(Native Method)
at edu.alibaba.mpc4j.common.tool.crypto.ecc.fourq.FourqByteFullEcc.mul(FourqByteFullEcc.java:111)
at edu.alibaba.mpc4j.s2pc.pcg.ot.base.np01.Np01ByteBaseOtSender.generateInitPayload(Np01ByteBaseOtSender.java:88)
at edu.alibaba.mpc4j.s2pc.pcg.ot.base.np01.Np01ByteBaseOtSender.send(Np01ByteBaseOtSender.java:58)
at edu.alibaba.mpc4j.s2pc.pcg.ot.cot.core.alsz13.Alsz13CoreCotReceiver.init(Alsz13CoreCotReceiver.java:61)
at edu.alibaba.mpc4j.s2pc.pcg.ot.cot.nc.ywl20.Ywl20NcCotReceiver.init(Ywl20NcCotReceiver.java:96)
at edu.alibaba.mpc4j.s2pc.pcg.ot.cot.impl.cache.CacheCotReceiver.init(CacheCotReceiver.java:71)
at edu.alibaba.mpc4j.s2pc.aby.basics.z2.rrg21.Rrg21Z2cReceiver.init(Rrg21Z2cReceiver.java:63)
at edu.alibaba.mpc4j.s2pc.aby.basics.z2.SingleDyadicZ2cReceiverThread.run(SingleDyadicZ2cReceiverThread.java:79)

image

运行其他-s2pc-的文件,也会出现类似错误。运行-common-的测试文件不会出现类似错误。

我的电脑配置为:

java version "17.0.5" 2022-10-18 LTS
Darwin Kernel Version 22.6.0:RELEASE_ARM64_T6000 arm64

麻烦您帮我看一下,非常感谢🙏

How to build and run the whole project?

I want to run the algorithm implemented in this repository on Linux, or MacOS. However, I can't find any documentation that tells me how to do it step by step. I've only seen compilation documentation for mpc4j-native-tool/fhe.

多线程Paillier加密引发的线程阻塞问题

mpc4j的作者您好,我想请教一个Paillier加密的问题。
我们在尝试使用多线程进行Paillier加密时遇到了线程阻塞的问题。
image
继续查看阻塞线程详情,发现Block在如下位置:
image
PheEngine在加密时使用SecureRandom生成随机数,而SecureRandom在Liunx环境下生成大量随机数的场景会出现阻塞情况,具体可以参考https://blog.csdn.net/weixin_45244678/article/details/106137948
博文中提到导致阻塞的原因是因为从/dev/random中读取随机数,而/dev/random中的数据来自系统的扰动,,比如键盘输入、鼠标点击等等,当系统扰动很小时,产生的随机数不够,导致读取/dev/random的进程会阻塞等待。
以上是问题背景,现在我有几个问题想请教:
1、文章中提到我们可以从/dev/urandom读取伪随机数来解决阻塞问题,请问伪随机数是否会使算法的安全性降低?
2、在保证算法安全性不会降低的前提下,是否还有其他方式可以解决Paillier在并发加密中出现的阻塞问题?
PS:我们的项目涉及非常敏感的数据,安全等级很高,因此我们希望可以在保证安全性的基础上提升加密性能。

addSubPtos的作用

刘老师您好,我在开发比较复杂的协议时可能会使用4个以上的子协议,这种情况下,有些子协议参与方就无法放到addSubPtos。我想知道这样会有什么影响。此外,在进行选择时,哪些子协议参与方具有更高的优先级。

感谢您的帮助!

FATAL_ERROR "Could not find FOUQ"

I encountered this error when compile 'mpc4j-native tool',and I use ubuntu 22.04. I compile passed after I changed the address to absolute address. I observed that the fourq library was included under the address 'mpc4j/mpc4j-native-fourq' and there was no mention of installing fourq in compile_ubuntu.md, I did not install fourq separately. So, this problem is probably of my own making.

使用conf文件进行测试问题

我在尝试使用conf文件开两个端口进行测试,文档里给的路径也比较模糊,我使用IDEA在根目录的pom.xml生成了各个子模块的jar文件。但是在terminal测试时候遇到报错:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no mpc4j-native-tool in java.library.path: /usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib

看来是mpc4j-native-tool/mpc4j-native-fhe没能找到,但是我在unit test时是可以使用的,可能因为unit test设置时使用了-Djava.library.path=/home/liury/PSU/mpc4j/mpc4j-native-tool/cmake-build-release。

我尝试在terminal的命令之后也加上了:

-Djava.library.path=/home/liury/PSU/mpc4j/mpc4j-native-tool/cmake-build-release/libmpc4j-native-tool.so 
-Djava.library.path=/home/liury/PSU/mpc4j/mpc4j-native-fhe/cmake-build-release/libmpc4j-native-fhe.so

但并没能奏效。
请问如何正确的使用conf文件进行测试?感谢。

mpc4j-s2pc-pir--初始化编辑多项式分区及填充问题

我有一个问题,就是partitionCount,是不是有多处不同含义的应用?哈希桶中每个桶分为partitionCount个,但是server端计算多项式返回的时候为什么也分区了?返回的数量是[partitionCount*密文数][多项式模数]?这个分区我不是很能理解

还有就是在布谷hash这一步实际上进行了两次的填充,如果在数据量很大的时候这两次填充很吃内存,是否能省略掉一次填充?

运行测试程序报错

基于mpc4j1.0.8写了一个测试程序,我使用了这个启动参数,报错如下,想问下是什么问题

-Djava.library.path=/issue/2pc/mpc4j/mpc4j-native-tool/cmake-build-release:/issue/2pc/mpc4j/mpc4j-native-fhe/cmake-build-release

image
image

mpc4j-s2pc-pir关于Labeld实现,server端数据2^25、26、27实验

我主要是想实验带标签的pir,现在用的是KwPirMain这个。
1第一个问题
我查阅了APSI中的参数json文件,发现1M/16M/256M的实验参数都有,因此我对应修改了server和client端的init函数,
if (maxRetrievalSize > 1) {
if (keywordLabelMap.size() > (1<<24)){ //>16M
params = Cmg21KwPirParams.SERVER_256M_CLIENT_MAX_4096;
}else if (keywordLabelMap.size() < (1<<20)){ //1M
params = Cmg21KwPirParams.SERVER_1M_CLIENT_MAX_4096;
}else{
params = Cmg21KwPirParams.SERVER_16M_CLIENT_MAX_4096;
}

/**
* expect server size 256 million, max client retrieval size 4096
/
public static final Cmg21KwPirParams SERVER_256M_CLIENT_MAX_4096 = Cmg21KwPirParams.uncheckCreate(
CuckooHashBinType.NAIVE_3_HASH, 6144, 4000,
4,
310, new int[]{ 1, 4, 10, 11, 28, 33, 78, 118, 143, 311, 1555},
67043329L, 8192, new int[]{50, 50, 50, 38, 30},
256000000, 4096
);
Cmg21KwPirParams参数中增加两个
/
*
* expect server size 16 million, max client retrieval size 4096
*/
public static final Cmg21KwPirParams SERVER_16M_CLIENT_MAX_4096 = Cmg21KwPirParams.uncheckCreate(
CuckooHashBinType.NAIVE_3_HASH, 6552, 1304,
5,
44, new int[]{ 1, 3, 11, 18, 45, 225},
4079617L, 8192, new int[]{56, 56, 56, 50 },
16000000, 4096
);
我用256M参数实验25次方,server端的计算很慢,基本开在init的第三步
2 第二个问题
就是我client端的查询数据是1000条,是要变成批量查询吗?我看KwPirMain中是1000次单条查询这个样子

采用KKRT16 (4 hash)进行求交集,结果不正确

1、ArrayList<Set> sets = PsoUtils.generateBytesSets(serverSetSize, clientSetSize, ELEMENT_BYTE_LENGTH)改为数组,如下图:
a6761ccb97ffeed50ee5e2fed74f8d66
2、在求交方法handleServerPrf进行结果输出,如下图:
image

您好,要怎么改才可以得到正确结果呢?

Add reference in README?

Highly suggest to add all paper references in README file for three purposes:

  1. Track the SOTA paper implementations.
  2. Provide tradeoff and benchmark references (in case bandwidth, computation resourcers are limited, they can select to switch to another solution in the repo) for business use.
  3. If new SOTA is available, you can get the news ASAP.

Thanks

FileRpc test fail

When running the RpcTest, we found one error message "Cannot delete file XXX_PAYLOAD".
The reason is that "bufferedReader.close()"(line239) should be called before "deleted = payloadFile.delete()"(line234) in the function "DataPacket receive(DataPacketHeader header)" of "FileRpc.java".

是否有相关协议特性汇总文档

代码中存在各种不同协议,并且涉及到密码学方面较多,如果直接通过代码去了解需要花费大量时间来区分,希望能提供更多文档,以供参考
1.代码各部分的功能详细介绍
2.各种协议的用途,区别,侧重
3.如何部署及实际使用

psi会有误判吗

image
我看代码中隐私集合求交,有使用布谷鸟哈希,布谷鸟哈希面对大数据量会有和布隆过滤器,判断数据一定不存在,判断存在是可能存在的情况,那请问这样是否会有数据误判情况产生

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.