mpz_invert() limit?

David Gillies daggillies at
Tue May 22 16:01:24 CEST 2012

On Tue, May 22, 2012 at 6:32 AM, Sam Kennedy <samstauk at> wrote:
> I've been using the mpz_invert() function as part of my RSA key generator,
> however if the values get much more than 9-10 digits long, the function
> returns an incorrect value.
> Is there a limit to the size of the numbers you can use with mpz_invert()?
> If so, what is that limit?
I've used mpz_invert, in code working with p-adic numbers and also in
an RSA-like situation, with inputs of several thousand bits. It is
dollars to doughnuts you are making a faulty assumption somewhere in
your code.

David Gillies
San Jose
Costa Rica

More information about the gmp-discuss mailing list