Open KushagraGupta02 opened 2 weeks ago
Hi!
I think you can use in your code the .get_edabit()
function (docs here) which should return a shared number in both arithmetic and binary domain.
Example:
r, r_bits = sint.get_edabit(edabits_length, True)
@KushagraGupta02, does this answer your question? Also note that you can convert sint
to sbitvec
, which can use edaBits for the simple conversion: https://mp-spdz.readthedocs.io/en/latest/Compiler.html#Compiler.GC.types.sbitvec
Dear @Poppy22 and @mkskeller,
Thank you very much for your inputs to my query - I still wanted to clarify a few things with regards to both these methods:
i) While using the .get_edabit() function, I am able to invoke it either through -
r, r_bits = sint.get_edabit(64, True)
or through
x = sint(2)
r, r_bits = x.get_edabit(64, True)
but in the second case, when I call
for i in range(0,len(r_bits)):
print_ln('r_bits[%s]: %s', i, r_bits[i].reveal())
print_ln('r: %s', r.reveal())
I am unable to see these combining to form "2". (In the first case as well, but we didn't attach any secret to it yet) So, it seems to me that this method is used to generate edabits (and not attach one to it), and I am not entirely sure how to extract the binary shares of bits by extending this - could you please help me with the same?
ii) When converting sint to sbitvec, I can see the consistent vector while calling print_ln('%s', [x.v[0].reveal(), x.v[1].reveal(), x.v[2].reveal()])
but it seems the x.v[0], .. bits are shared arithmetically, so could you give me some suggestions to get the boolean shares of bits out of this? (if the edabits object has that information)
Your suggestions and help would be greatly valued! I apologise for the delay in reverting back.
Thanks and best regards, Kushagra Gupta
get_edabit
doesn't a give a bit decomposition but a random value, so wouldn't see "2" like this.
Dear Marcel,
I want to reshare arithmetic shares of a shared secret integer to multiple binary shares, and I think I can somehow just use the binary shares in edabits to extract those by activating them - could you help with the following?
Adding the -Y option creates and uses edabits (strict/loose) to efficiently support comparisons etc - it adds those instructions to the bytecode in another compilation pass, but could you let me know if is there any instruction to pass on/emit the binary shares of edabits?
If not, could you please give an idea on how to i) either modify the compilation to reveal the binary shares in edabits (at the python API level) - (as binary conversion runs the binary VM, which supports reveal functions) or ii) how to proceed about creating a new instruction (at C++/Python level) to get the binary shares?
Your suggestions and help would be greatly valued!
Thanks and best regards, Kushagra Gupta