diff options
author | Josh Hoyt <josh@janrain.com> | 2006-01-06 02:16:16 +0000 |
---|---|---|
committer | Josh Hoyt <josh@janrain.com> | 2006-01-06 02:16:16 +0000 |
commit | dda0e5d3b3d004fba69dd07982f12118bf29213f (patch) | |
tree | c937bcde4a6c53d391875481beccfac1d9ed398e /Net/OpenID/CryptUtil.php | |
parent | ba2ca3d6b9abf29123aff36183c860c4dd57fa63 (diff) | |
download | php-openid-dda0e5d3b3d004fba69dd07982f12118bf29213f.zip php-openid-dda0e5d3b3d004fba69dd07982f12118bf29213f.tar.gz php-openid-dda0e5d3b3d004fba69dd07982f12118bf29213f.tar.bz2 |
[project @ Make cryptutil pass test with GMP]
Diffstat (limited to 'Net/OpenID/CryptUtil.php')
-rw-r--r-- | Net/OpenID/CryptUtil.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Net/OpenID/CryptUtil.php b/Net/OpenID/CryptUtil.php index fa32a40..d1514f9 100644 --- a/Net/OpenID/CryptUtil.php +++ b/Net/OpenID/CryptUtil.php @@ -150,12 +150,13 @@ class Net_OpenID_CryptUtil { $lib =& Net_OpenID_MathLibrary::getLibWrapper(); - if ($lib->cmp($long, 0) < 0) { + $cmp = $lib->cmp($long, 0); + if ($cmp < 0) { print "numToBytes takes only positive integers."; return null; } - if ($long == 0) { + if ($cmp == 0) { return "\x00"; } @@ -189,7 +190,6 @@ class Net_OpenID_CryptUtil { */ function binaryToLong($str) { - $lib =& Net_OpenID_MathLibrary::getLibWrapper(); if ($str === null) { @@ -335,7 +335,7 @@ class Net_OpenID_CryptUtil { $bytes = '\x00' . Net_OpenID_CryptUtil::getBytes($nbytes); $n = Net_OpenID_CryptUtil::binaryToLong($bytes); // Keep looping if this value is in the low duplicated range - if ($n >= $duplicate) { + if ($lib->cmp($n, $duplicate) >= 0) { break; } } |