-
Notifications
You must be signed in to change notification settings - Fork 78
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
Issue with recombine function at mpyc/thresha.py #97
Comments
Hi, yes, the problem is that you use This constraint will be lifted in the near future say. The raw material to handle the general case of a secret-shared So, if you add this line _, m = _divmod(b, m) Note that |
Hi, thanks for your help! We tested and it work perfectly. We close the issue .Thanks for your note too ;) The code is attached in case someone needs it in the future: from mpyc.runtime import mpc
from mpyc.secgroups import _divmod
bits= 64
async def mod_inverse(b, m):
original_m = m
sec_int = mpc.SecInt(bits)
sec_int_one = sec_int(1)
x0, x1 = sec_int(0), sec_int(1)
if await mpc.output(mpc.eq(m,sec_int_one)):
return 0
while await mpc.output(mpc.ge(b,sec_int(2))):
b2 = m
q, m = _divmod(b, m)
b = b2
x0, x1 = x1 - q * x0, x0
if await mpc.output(mpc.lt(x1,sec_int(0))):
x1 = x1 + original_m
return x1
async def main():
await mpc.start()
sec_int = mpc.SecInt(bits)
print("TESTING INVERSE-MOD")
# Example of inverse mod with 3 and 7 (sol = 5)
b = sec_int(3)
m = sec_int(7)
sol = await mod_inverse(b,m)
print(await mpc.output(sol))
await mpc.shutdown()
if __name__ == "__main__":
mpc.run(main()) |
Executing my program I found an error on mpyc/thresha.py:
To reproduce this error we have to execute the following code:
We are testing this code with 3 players on local. This are the output for each player (We tested various times and we get the same errors on different players. Not always the same error for the same player)
PLAYER 0 (HANGED)
PLAYER 1
PLAYER 2
We tested with 2 players and it work, but the errors appears when we started to use more than 2 players.
I hope this issue can help to improve the repo and we can find a solution for this problem. Thanks for your work at MPyC :)
The text was updated successfully, but these errors were encountered: