Efficient (HUGE) prime modulus
__peter__ at web.de
Mon Nov 19 18:13:20 CET 2007
> A = (G ** a) % P # G^a mod P
> ###### END #####
> The above code takes a very long time. If I make little a only 16 bits
> instead of 512, it takes about 12 seconds on my machine to compute. Is
> this incorrect usage of **? I used math.pow and built-in pow. The
> math.pow complained about converting a long to a float. The built in
> pow() took a very long time as well.
Even in its three-argument form?
pow(x, y[, z]) -> number
With two arguments, equivalent to x**y. With three arguments,
equivalent to (x**y) % z, but may be more efficient (e.g. for longs).
More information about the Python-list