snwagh / falcon-public

Implementation of protocols in Falcon
89 stars 45 forks source link

How to transform `RSSVectorSmallType` to `RSSVectorMyType`? #12

Closed WeiViming closed 3 years ago

WeiViming commented 3 years ago

Hello, @snwagh . FALCON is a nice code! Thank you for your work! Recently, I want to find a way to transform RSSVectorSmallType (is a bit vector on Z_67) to RSSVectorMyType (bit vector on Z_L). But I have not idea yet. Do you have any advice? Thanks.

snwagh commented 3 years ago

Thank you, if I understand correctly, ignoring the vectorization, you want a way to convert a single bit (shared modulo 67) to a single bit (shared modulo L)? Such a method is not implemented in the codebase yet. A daBit is the cryptographic primitive that you would need. For starters, you can assume access to precomputed conversions and then use the Beaver's randomization trick: given [b]_67 and using [b']_67 and [b']_L you can open c = b ⊕ b' modulo 67 and then compute c ⊕ b' modulo L.

WeiViming commented 3 years ago

Great! Yes, your understanding is correct. The Beaver's trick is helpful! Thank you for your advice. Can this trick be vectorized? Actually, I want to compute A=BC, where [A]_L, [B]_67, [C]_L. This is why I need to find a way to transform [b]_67 into [b]_L.

WeiViming commented 3 years ago

Maybe the Select Shares protocol can help me with this computation. Right? :)

snwagh commented 3 years ago

The trick can be vectorized so extends without any additional lower level implementation.

About the A=BC computation, the Select Shares protocol is a good reference as it has a lot of the relevant code but it performs a slightly different computation. First, elements of B are boolean shares (note that elements of Z_67 and Z_2 are both stored using the smallType datatype using 8 bits) whereas in your case they are sharing over Z_67. And second, the functionality is reversed in the sense that A=C if B=0 and A=0 if B=1; so the functionality is more like A=(1-B)C. With these differences, especially the first, the code will give you incorrect results if used directly.

WeiViming commented 3 years ago

Yes, I see the comment on SS functionality. As you say, the SS functionality is more like A=(1-B)C. If I consider B is a bit sharing over Z_2, how can I convert [B]_2 to [\neg B]_2 in secret share form? Is the Falcon codebase implement or not? In this way, I can compute A=BC by using SS, where [B]_2. Isn't it? :)

Update: I have finished this computation in this way. Really thanks for your help!

snwagh commented 3 years ago

Two things

WeiViming commented 3 years ago

Thank you very much! :)