You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the method "modinv" in the file zen_big.c, seems that this method find succesfully the inverse of a big number only if the modulo is a prime number.
When the modulo is a composite number two things can happen:
the computation doesn't stop (for example when the big number in input is not invertible).
It gives a wrong inverse.
For example in the ring Z/6Z the element 5 is invertible and its inverse is 5 since 25 mod 6 = 1. Instead the output of the function is 3.
local x = BIG.new(5)
local module = BIG.new(6)
local inv_x = x:modinv(module)
print(inv_x:decimal())
The text was updated successfully, but these errors were encountered:
Looking deeper into milagro library it seems to use the binary method in order to compute the modulo inverse. This algorithm, if I remember well, works only with odd modulos. Need to search better for this, if this is the case than we should add a check on the parity of the modulo.
Looking at the method "modinv" in the file zen_big.c, seems that this method find succesfully the inverse of a big number only if the modulo is a prime number.
When the modulo is a composite number two things can happen:
For example in the ring Z/6Z the element 5 is invertible and its inverse is 5 since 25 mod 6 = 1. Instead the output of the function is 3.
The text was updated successfully, but these errors were encountered: