Fastest modular exponentiation in JavaScript

后端 未结 4 1575
余生分开走
余生分开走 2021-02-01 09:38

My problem is to compute (g^x) mod p quickly in JavaScript, where ^ is exponentiation, mod is the modulo operation. All inputs are nonnega

4条回答
  •  广开言路
    2021-02-01 10:16

    Would some other client side technology that's callable from JS, such as a Java applet or Flash movie, be acceptable? BigInt's approach is already fairly fast. You can tweak BigInt, or you can try a different algorithm, but you probably won't get an order of magnitude improvement.

提交回复
热议问题