Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-03-29 21:04:51
-----BEGIN PGP SIGNED MESSAGE-----
On 03/29/2010 08:42 PM, Scott McMurray wrote:
> Those two functions, invmod and random_prime, can use xint() as their
> error code, if the relevant exception is blocked, since 0 is obviously
> neither a multiplicative inverse or a prime.
Close, but not quite: the inverse of zero is zero.
> That even lets you use them like error codes: [...] Though personally
> I think I'd still prefer an exception. If I'm doing RSA and there's
> no inverse, something has gone drastically wrong.
Agreed, if you're doing RSA. And in that case, you can ignore the
Not-a-Number return value, secure in the knowledge that, if your prime
number isn't actually prime, you'll get a signaling NaN back, and the
library will pitch a fit (and an exception) when you try to use it. ;-)
Oak Circle Software, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----