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

How did you perform the comparison protocol in SPU #16

Closed
BeStrongok opened this issue Aug 11, 2022 · 8 comments
Closed

How did you perform the comparison protocol in SPU #16

BeStrongok opened this issue Aug 11, 2022 · 8 comments

Comments

@BeStrongok
Copy link

BeStrongok commented Aug 11, 2022

Dear authors:
Thank you for the wonderful code. I was wondering how you implemented the comparison protocol in the SPU, i haven't found the corresponding code. The protocol for comparison is LTZ, did you used this prototol? Looking for your reply!

@BeStrongok BeStrongok changed the title How to implement the comparison protocol in spu How to implement the comparison protocol in SPU Aug 11, 2022
@BeStrongok BeStrongok changed the title How to implement the comparison protocol in SPU How did you perform the comparison protocol in SPU Aug 11, 2022
@6fj
Copy link
Member

6fj commented Aug 11, 2022

Hi @BeStrongok ,

Yes, we are using the same idea here, please check https://github.com/secretflow/spu/blob/beta/spu/hal/ring.cc#L141-L146.

@6fj 6fj closed this as completed Aug 17, 2022
@BeStrongok
Copy link
Author

BeStrongok commented Aug 23, 2022

Thanks for your reply, but i haven't find the implementation code of the function _msb, dose you directly reveal the difference x - y and get the msb of the revealed result?

@icavan
Copy link

icavan commented Aug 23, 2022

Thanks for your reply, but i haven't find the implementation code of the function _msb, dose you directly reveal the difference x - y and get the msb of the revealed result?

We should not reveal any value here.

Currently, some protocols adopt the arithmetic shares to boolean shares (A2B) procedure. Thus you could get any bit, including the MSB. Some protocol, say cheetah, has a dedicated MSB implementation. Check here.

A more wise way is to directly perform a carry-out circuit calculation which has a similar procedure as the A2B routine. The carry-out circuit will be supported soon.

@BeStrongok
Copy link
Author

Cool!! I will learn this code. I'm confused that the shares is generated randomly, so it cannot be used for comparison locally, after A2B procedure, we need to reveal the MSB bit, is my understanding correct?

@icavan
Copy link

icavan commented Aug 23, 2022

Cool!! I will learn this code. I'm confused that the shares is generated randomly, so it cannot be used for comparison locally, after A2B procedure, we need to reveal the MSB bit, is my understanding correct?

The MSB is also kept in secret sharing form, either boolean or arithmetic. Everything has to be confidential inside a generic secure multiparty computation protocol. Once you've decided to open the secret, you need to reveal it explicitly.

@BeStrongok
Copy link
Author

Cool!! I will learn this code. I'm confused that the shares is generated randomly, so it cannot be used for comparison locally, after A2B procedure, we need to reveal the MSB bit, is my understanding correct?

The MSB is also kept in secret sharing form, either boolean or arithmetic. Everything has to be confidential inside a generic secure multiparty computation protocol. Once you've decided to open the secret, you need to reveal it explicitly.

Thanks for your guidance, i understand. After A2B procedure, parties can get the secret shares of MSB locally, once we want to open this secret, we need to reveal it explicitly, we can't directly reveal it in the source code implicitly.

@BeStrongok
Copy link
Author

BeStrongok commented Sep 21, 2022

Thanks for your reply, but i haven't find the implementation code of the function _msb, dose you directly reveal the difference x - y and get the msb of the revealed result?

We should not reveal any value here.

Currently, some protocols adopt the arithmetic shares to boolean shares (A2B) procedure. Thus you could get any bit, including the MSB. Some protocol, say cheetah, has a dedicated MSB implementation. Check here.

A more wise way is to directly perform a carry-out circuit calculation which has a similar procedure as the A2B routine. The carry-out circuit will be supported soon.

Hi~
I noticed that you will implement carry-out circuit calculation, i read the corresponding paper and find that the protocol BitLTL needs log(k) communication rounds, which is not effecient enough, especially handling larger amount of data.
I'm wondering that is there any protocol can be implemented with constant round complexity?
The paper is Improved Primitives for Secure Multiparty Integer Computation.

@rivertalk
Copy link

Hi @BeStrongok

Carry-out circuit is supported in the latest SPU implementation (for ABY3 protocol), but it's only helps to reduce the total number of communication data, not communication rounds, the rounds is still log(k).

AFAIK, at least log(k) rounds is required :(

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