pycryptodome
pycryptodome copied to clipboard
The existence of the factor was not verified in function inverse
The existence of the factor was not verified in function inverse() sometime get 1 as the return value maybe ..... we can compute gcd alg first ?
def inverse(u, v):
"""The inverse of :data:`u` *mod* :data:`v`."""
u3, v3 = u, v
u1, v1 = 1, 0
while v3 > 0:
q = u3 // v3
u1, v1 = v1, u1 - v1*q
u3, v3 = v3, u3 - v3*q
while u1<0:
u1 = u1 + v
return u1