summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2005-12-30 00:47:16 +0000
committertailor <cygnus@janrain.com>2005-12-30 00:47:16 +0000
commitdcc3ffe4641845c9c308f6612040b11637811508 (patch)
treef712f4a50538c3adbe3d3c21147346350072b5a5
parent8528b291e2b8de89282b65b82b58768b0804ccf6 (diff)
downloadphp-openid-dcc3ffe4641845c9c308f6612040b11637811508.zip
php-openid-dcc3ffe4641845c9c308f6612040b11637811508.tar.gz
php-openid-dcc3ffe4641845c9c308f6612040b11637811508.tar.bz2
[project @ Added maxint function]
-rw-r--r--Net/OpenID/CryptUtil.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/Net/OpenID/CryptUtil.php b/Net/OpenID/CryptUtil.php
index ec83df4..2c75e20 100644
--- a/Net/OpenID/CryptUtil.php
+++ b/Net/OpenID/CryptUtil.php
@@ -72,6 +72,21 @@ class Net_OpenID_CryptUtil {
return $bytes;
}
+ function maxint() {
+ /**
+ * quick-and-dirty function for PHP int size -- assumes
+ * largest integer is of form 2^n - 1
+ */
+ $to_test = pow(2, 16);
+ while (1) {
+ $last = $to_test;
+ $to_test = 2 * $to_test;
+ if (($to_test < $last) || (!is_int($to_test))) {
+ return($last + ($last - 1));
+ }
+ }
+ }
+
/**
* Computes the SHA1 hash.
*