My problem is to compute (g^x) mod p quickly in JavaScript, where ^ is exponentiation, mod is the modulo operation. All inputs are nonnega
(g^x) mod p
^
mod
Try this Montgomery modular reduction from http://code.google.com/p/bi2php/ on JavaScript.