Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: 如何得到两方安全计算后的share值用于下一步计算 #975

Closed
numpyzu opened this issue Jan 15, 2025 · 4 comments
Closed
Assignees

Comments

@numpyzu
Copy link

numpyzu commented Jan 15, 2025

Feature Request Type

Build/Install

Have you searched existing issues?

Yes

Is your feature request related to a problem?

我参考了 #963 ,但是它不是实际两方进行运算的过程。
下面是我的例子:
import spu
import secretflow as sf
import numpy as np

cluster_def = {
'nodes': [
{
'party': 'alice',
'address': '127.0.0.1:50051', # Alice 的通信地址
'listen_addr': '0.0.0.0:50051' # Alice 的监听地址
},
{
'party': 'bob',
'address': '127.0.0.1:50052', # Bob 的通信地址
'listen_addr': '0.0.0.0:50052' # Bob 的监听地址
},
],
'runtime_config': {
'protocol': spu.spu_pb2.CHEETAH, # 协议类型,例如SEMI2K
'field': spu.spu_pb2.FM64, # 字段类型,例如FM128
'beaver_type': spu.spu_pb2.RuntimeConfig.MultiParty,
'enable_pphlo_profile' : True , # 开启调试模式
'enable_action_trace' : True
}
}

spu = sf.SPU(cluster_def=cluster_def)

alice, bob = sf.PYU('alice'), sf.PYU('bob')

def data_a():
return np.array([5,4])

alice_data =alice(data_a)()

def data_b():
return np.array([1,2])

bob_data = bob(data_b)()

def secure_multiply(x,y):
return x*y

result = spu(secure_multiply)(alice_data, bob_data)
现在我想知道Alice和Bob分别拿到的share是多少,因为两方需要接下来对share进行一些特殊的运算

Describe features you want to add to SPU

我想要了解如何提取 Alice 和 Bob 在执行 secure_multiply 时分别持有的秘密共享数据,有这个接口可以得到吗?

Describe features you want to add to SPU

A clear and concise description of any alternative solutions or features you've considered.

@w-gc
Copy link
Collaborator

w-gc commented Jan 15, 2025

“Alice和Bob分别拿到的share是多少”?????这会导致秘密泄露,不支持。

@ppdogclub
Copy link

“Alice和Bob分别拿到的share是多少”?????这会导致秘密泄露,不支持。

请问alice或者bob无法输出自己持有的share吗?

@w-gc
Copy link
Collaborator

w-gc commented Jan 16, 2025

  1. 如果使用的是spu Python API,那么每方(Alice/Bob)可以拿到自己这方的share,但是这个share是经过了protobuf编码的,没有提供解码的API;
  2. 如果使用的是spu C++ API,那么同样可以拿到,各自的是Value类型数据。

@ppdogclub
Copy link

  1. 如果使用的是spu Python API,那么每方(Alice/Bob)可以拿到自己这方的share,但是这个share是经过了protobuf编码的,没有提供解码的API;
  2. 如果使用的是spu C++ API,那么同样可以拿到,各自的是Value类型数据。

谢谢回复!

@w-gc w-gc closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants