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]: 如何在emulator.run中打开一个秘密共享值,从而更灵活地设计协议 #912

Closed
zhou-pz opened this issue Nov 12, 2024 · 7 comments

Comments

@zhou-pz
Copy link

zhou-pz commented Nov 12, 2024

Feature Request Type

Usability

Have you searched existing issues?

Yes

Is your feature request related to a problem?

我想在emulator.run中打开一个秘密共享值,并用于数组位置索引,然而我不知道如何在SPU中实现这个能力

Describe features you want to add to SPU

A clear and concise description of what you want to happen.

Describe features you want to add to SPU

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

@tpppppub
Copy link
Member

理论上你这个 reveal 后做 public indexing 不是纯 mpc 程序,你只能 reveal 前后分别在 spu 上跑

@zhou-pz
Copy link
Author

zhou-pz commented Nov 12, 2024

理论上你这个 reveal 后做 public indexing 不是纯 mpc 程序,你只能 reveal 前后分别在 spu 上跑

我是想实现这篇文章里的Dijkstra算法:A Fast, Practical and Simple Shortest Path Protocol for Multiparty Computation。它通过事先的洗牌打乱原始输入的位置,后续reveal后做public indexing泄露的是洗牌后的数据分布,与原始输入的数据分布无关,从而保证安全性。

如果只能reveal 前后分别在 spu 上跑的话,我不想reveal的值如何在两个emulator.run之间保持密文状态?

@tpppppub
Copy link
Member

没明白你的意思,reveal 后不就是明文值了吗

@zhou-pz
Copy link
Author

zhou-pz commented Nov 12, 2024

比如emulator.run里跑的程序有值v和数组A,我想把v reveal,然后再创建一个emulator.run把明文的v和密文的A作输入。怎么让A一直保持密文状态?

@tpppppub
Copy link
Member

没 reveal 就是密文,另外你的需求在 secretflow 里做似乎更方便

@deadlywing
Copy link
Contributor

hello,我理解你可以尝试这样做:

def func1(inputs):
   return compute_v()

def func2(inputs, v):
  A = compute_A()
  return do_things(v, A)

seal_inputs = emulator.seal(inputs)

# get plaintext v
v = emulator.run(func1)(seal_inputs)
# use plaintext v
ret = emulator.run(func2, static_argnums=(1,))(seal_inputs, v)

BTW,同觉得你这个算法用SecretFlow实现会更直接。

@zhou-pz
Copy link
Author

zhou-pz commented Nov 12, 2024

好的,十分感谢!有空我也去了解一下SecretFlow

@zhou-pz zhou-pz closed this as completed Nov 12, 2024
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

3 participants