RSA implementation with PHP

lnrfog

New Member
I'm trying to program an implementation of the RSA algorithm. For that I need to compute modular exponentiations with very big numbers in PHP.For example: c^d Mod n, where c,d,n are about 1024 bits long.This works with bcpowmod, but the runtime is very bad. The computation of one such number needs about 2-3 secs. In Java with BigInteger and in JavaScript with an equal implementation of BigInteger the same step needs ca. 0.04 secs.Is there another way in PHP, or how else could I do this server-side?This is the code in PHP:\[code\]$c = "alongnumber";$d = "alongnumber";$n = "alongnumber";$m = bcpowmod($c,$d,$n);\[/code\]Thanks in advance!
 
Back
Top