
Boost : 
From: Carlo Wood (carlo_at_[hidden])
Date: 20060530 21:19:49
On Tue, May 30, 2006 at 09:20:59AM 0700, Geoffrey Irving wrote:
> > Z<r> x = N;
> > Z<s> y = N;
>
> As pointed out by someone else already, what if r = 2^304024571?
>
> More fundamentally, encryption usually fails if the secret prime numbers are
> hard coded into the encryption code as template arguments. Unless you want
> the encryption code to recompile itself whenever it generates a new random
> key, that is.
Okay. I agree that it should be possible to have dynamic (or nonbuiltin
integral) numbers for the modulo (say 'p'). One could still argue that in those
cases it probably isn't necessary to work in Z_p, but well. A general library
shouldn't post restrictions on practical use like that, I guess and you
are right that a template argument would be limited to int or long long at
most.
The only real advantage of using a template argument is probably that you
can make things faster during runtime  but as always, the algorithm used
is much more important than some constant factor that one might gain there.
So, I'm convinced ;). I'm okay with a library that allows the modulo
to be set during runtime.
 Carlo Wood <carlo_at_[hidden]>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk