Closed b-kamphorst closed 11 months ago
Oh, yes, the line b = await self.gather(b)
may put you on the wrong track, although the next lines go on to use b
as a publicly known integer. The intent for future extension is that b
will be allowed to be of a secure type, hence used as a secret-shared value.
For secure groups we already use integer division with a secure divisor. You can try to use this code by defining div
as follows:
from mpyc.secgroups import _divmod
div = lambda a, b: _divmod(a, b)[0]
Maybe that helps you out, for now?
That indeed suffices for now, thank you for the quick reply (as always)!
Hi @lschoe! I ran into an issue with integer division of secure integers. The following script fails for me when ran with at least three players (
-M 3
):I am aware that the docstring of
SecureNumber.__floordiv__
statespublic divisor
. I wanted to work around this by usingRuntime.mod
, which seems to be designed to work explicitly with secure divisors as it starts withb = await self.gather(b)
. Since__floordiv__
actually callsmod
under the hood, this yields the same error (but now the root of the issue is slightly narrowed down).Should it indeed be possible to perform secure integer division/ modular reduction with public divisor/ modulus? If so, I am doing something wrong or this is a bug. If not, would you be willing to support (approximate) integer division?
Looking forward to your thoughts.