lschoe / mpyc

MPyC: Multiparty Computation in Python
MIT License
367 stars 76 forks source link

How is prime p and the order of the finite field determined for ```thresha.random_split``` #59

Closed RetoKrummenacher closed 1 year ago

RetoKrummenacher commented 1 year ago

Hi Berry,

Sorry for disturbing you again, but I was wondering how MPyC sets field.modulus and field.order used to create the Shamir Polynomials in thresha.random_split()

I saw that they are set to be the same in finfields.pGF and that the prime $p$ is determined with find_prime_root(l) with bit length l=bit_length+sec_param, defaulting to $62=32+30$ as defined in the get_arg_parser().

But not sure if that is really the case?

Thanks for a clarification.

lschoe commented 1 year ago

So, field.modulus and field.order are in general not the same. This is only true for prime order fields, which you are probably considering. For extension fields, we have that field.modulus is actually a polynomial (irreducible), and field.order is then a prime power (and there is also field.characteristic, which is always a prime number).

Functions like mpc.SecFld() and mpc.SecInt() create finite fields of the appropriate type, and the code for this is in the module mpyc.sectypes.