Efficient (HUGE) prime modulus

Paul McGuire ptmcg at austin.rr.com
Mon Nov 19 18:17:27 CET 2007


On Nov 19, 10:32 am, blaine <frik... at gmail.com> wrote:
> Hey guys,
>   For my Network Security class we are designing a project that will,
> among other things, implement a Diffie Hellman secret key exchange.
> The rest of the class is doing Java, while myself and a classmate are
> using Python (as proof of concept).  I am having problems though with
> crunching huge numbers required for calculations.  As an alternative I
> can use Java - but I'd rather have a pure python implementation.  The
> problem is that Python takes a very long time (I haven't had it finish
> yet) - but Java does it in 3 seconds.  Suggestions?

Did you try the 3-argument version of the built-in pow?

A = pow(G,a,P)


Takes about .1 second on my machine, with your values. (I didn't
verify that the answer I got was correct, though.)

-- Paul



More information about the Python-list mailing list