Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Commit

Permalink
Merge pull request #10 from fredefl/master
Browse files Browse the repository at this point in the history
Added gmp_powm function so decryption is now WAY faster.
  • Loading branch information
HazAT committed Jan 10, 2012
2 parents d6c8e40 + b6d3180 commit 2781ec8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jcryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ public function decrypt($encrypted, $dec_key, $enc_mod) {
$max = count($blocks);
for ($i=0; $i < $max; $i++) {
$dec = $this->_hex2bint($blocks[$i]);
$dec = bcpowmod($dec, $dec_key, $enc_mod);
if (function_exists('gmp_strval') && function_exists('gmp_powm')){
$dec = gmp_strval(gmp_powm($dec, $dec_key, $enc_mod));
} else {
$dec = bcpowmod($dec, $dec_key, $enc_mod);
}
$ascii = $this->_bint2char($dec);
$result .= $ascii;
}
Expand Down

0 comments on commit 2781ec8

Please sign in to comment.