summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2005-12-30 00:58:47 +0000
committertailor <cygnus@janrain.com>2005-12-30 00:58:47 +0000
commit092abb7e606dc2f0246cc668b6fd90739c508b75 (patch)
tree9cedb70e07de89983248a520d9a05ffdaba27df0
parent67b85c935df7914d01d339944bea84739afb2f5c (diff)
downloadphp-openid-092abb7e606dc2f0246cc668b6fd90739c508b75.zip
php-openid-092abb7e606dc2f0246cc668b6fd90739c508b75.tar.gz
php-openid-092abb7e606dc2f0246cc668b6fd90739c508b75.tar.bz2
[project @ Added more operations to the math library classes]
-rw-r--r--Net/OpenID/CryptUtil.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/Net/OpenID/CryptUtil.php b/Net/OpenID/CryptUtil.php
index e2ca995..5aca7e8 100644
--- a/Net/OpenID/CryptUtil.php
+++ b/Net/OpenID/CryptUtil.php
@@ -278,6 +278,14 @@ class Net_OpenID_MathWrapper {
return mt_rand($min, $max);
}
+ function pow($base, $exponent) {
+ return pow($base, $exponent);
+ }
+
+ function add($x, $y) {
+ return $x + $y;
+ }
+
function cmp($x, $y) {
if ($x > $y) {
return 1;
@@ -300,6 +308,10 @@ class Net_OpenID_MathWrapper {
return $x * $y;
}
+ function sub($x, $y) {
+ return $x - $y;
+ }
+
function div($x, $y) {
return $x / $y;
}
@@ -332,6 +344,18 @@ class Net_OpenID_BcMathWrapper extends Net_OpenID_MathWrapper {
return mt_rand($min, $max);
}
+ function add($x, $y) {
+ return bcadd($x, $y);
+ }
+
+ function sub($x, $y) {
+ return bcsub($x, $y);
+ }
+
+ function pow($base, $exponent) {
+ return bcpow($base, $exponent);
+ }
+
function cmp($x, $y) {
return bccomp($x, $y);
}
@@ -366,6 +390,18 @@ class Net_OpenID_GmpMathWrapper extends Net_OpenID_MathWrapper {
return gmp_random($max);
}
+ function add($x, $y) {
+ return gmp_add($x, $y);
+ }
+
+ function sub($x, $y) {
+ return gmp_sub($x, $y);
+ }
+
+ function pow($base, $exponent) {
+ return gmp_pow($base, $exponent);
+ }
+
function cmp($x, $y) {
return gmp_cmp($x, $y);
}