/** * invert using bcmath extension */ function _invertBcmath($x, $y) { while (bccomp($x, 0) < 0) { $x = bcadd($x, $y); } $r = Security_DSA::_exgcdBcmath($x, $y); if ($r[2] == 1) { $a = $r[0]; while (bccomp($a, 0) < 0) { $a = bcadd($a, $y); } return $a; } else { return false; } }